Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: net/quic/quic_packet_creator.cc

Issue 1526083002: Deprecate --gfe2_reloadable_flag_quic_packet_creator_prefetch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run git rebase_update Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_packet_creator.cc
diff --git a/net/quic/quic_packet_creator.cc b/net/quic/quic_packet_creator.cc
index 7c1cadef4a8ae97ce69fbe8e4f69536e1be0ca39..c89058dcff862b60f17b427d490094c1c5f19912 100644
--- a/net/quic/quic_packet_creator.cc
+++ b/net/quic/quic_packet_creator.cc
@@ -347,54 +347,43 @@ void QuicPacketCreator::CopyToBuffer(QuicIOVector iov,
}
DCHECK_LE(iovnum, iov.iov_count);
DCHECK_LE(iov_offset, iov.iov[iovnum].iov_len);
- if (FLAGS_quic_packet_creator_prefetch) {
- if (iovnum >= iov.iov_count || length == 0) {
- return;
- }
+ if (iovnum >= iov.iov_count || length == 0) {
+ return;
+ }
- // Unroll the first iteration that handles iov_offset.
- const size_t iov_available = iov.iov[iovnum].iov_len - iov_offset;
- size_t copy_len = min(length, iov_available);
-
- // Try to prefetch the next iov if there is at least one more after the
- // current. Otherwise, it looks like an irregular access that the hardware
- // prefetcher won't speculatively prefetch. Only prefetch one iov because
- // generally, the iov_offset is not 0, input iov consists of 2K buffers and
- // the output buffer is ~1.4K.
- if (copy_len == iov_available && iovnum + 1 < iov.iov_count) {
- // TODO(ckrasic) - this is unused without prefetch()
- // char* next_base = static_cast<char*>(iov.iov[iovnum + 1].iov_base);
- // Prefetch 2 cachelines worth of data to get the prefetcher started;
- // leave it to the hardware prefetcher after that.
+ // Unroll the first iteration that handles iov_offset.
+ const size_t iov_available = iov.iov[iovnum].iov_len - iov_offset;
+ size_t copy_len = min(length, iov_available);
+
+ // Try to prefetch the next iov if there is at least one more after the
+ // current. Otherwise, it looks like an irregular access that the hardware
+ // prefetcher won't speculatively prefetch. Only prefetch one iov because
+ // generally, the iov_offset is not 0, input iov consists of 2K buffers and
+ // the output buffer is ~1.4K.
+ if (copy_len == iov_available && iovnum + 1 < iov.iov_count) {
+ // TODO(ckrasic) - this is unused without prefetch()
+ // char* next_base = static_cast<char*>(iov.iov[iovnum + 1].iov_base);
+ // char* next_base = static_cast<char*>(iov.iov[iovnum + 1].iov_base);
+ // Prefetch 2 cachelines worth of data to get the prefetcher started; leave
+ // it to the hardware prefetcher after that.
+ // TODO(ckrasic) - investigate what to do about prefetch directives.
+ // prefetch(next_base, PREFETCH_HINT_T0);
+ if (iov.iov[iovnum + 1].iov_len >= 64) {
// TODO(ckrasic) - investigate what to do about prefetch directives.
- // prefetch(next_base, PREFETCH_HINT_T0);
- if (iov.iov[iovnum + 1].iov_len >= 64) {
- // TODO(ckrasic) - investigate what to do about prefetch directives.
- // prefetch(next_base + CACHELINE_SIZE, PREFETCH_HINT_T0);
- }
+ // prefetch(next_base + CACHELINE_SIZE, PREFETCH_HINT_T0);
}
+ }
- const char* src = static_cast<char*>(iov.iov[iovnum].iov_base) + iov_offset;
- while (true) {
- memcpy(buffer, src, copy_len);
- length -= copy_len;
- buffer += copy_len;
- if (length == 0 || ++iovnum >= iov.iov_count) {
- break;
- }
- src = static_cast<char*>(iov.iov[iovnum].iov_base);
- copy_len = min(length, iov.iov[iovnum].iov_len);
- }
- } else {
- while (iovnum < iov.iov_count && length > 0) {
- const size_t copy_len = min(length, iov.iov[iovnum].iov_len - iov_offset);
- memcpy(buffer, static_cast<char*>(iov.iov[iovnum].iov_base) + iov_offset,
- copy_len);
- iov_offset = 0;
- length -= copy_len;
- buffer += copy_len;
- ++iovnum;
+ const char* src = static_cast<char*>(iov.iov[iovnum].iov_base) + iov_offset;
+ while (true) {
+ memcpy(buffer, src, copy_len);
+ length -= copy_len;
+ buffer += copy_len;
+ if (length == 0 || ++iovnum >= iov.iov_count) {
+ break;
}
+ src = static_cast<char*>(iov.iov[iovnum].iov_base);
+ copy_len = min(length, iov.iov[iovnum].iov_len);
}
LOG_IF(DFATAL, length > 0) << "Failed to copy entire length to buffer.";
}
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698