aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRoman Gushchin <klamm@yandex-team.ru>2014-10-22 23:32:27 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-10-30 07:56:52 -0400
commitbc16e47f03a7dce9ad68029b21519265c334eb12 (patch)
treef8f434d6059d1809bd79ff13f9443fb374d25b15 /drivers/net
parenta22bb0b9b9b09b4cc711f6d577679773e074dde9 (diff)
igb: don't reuse pages with pfmemalloc flag
Incoming packet is dropped silently by sk_filter(), if the skb was allocated from pfmemalloc reserves and the corresponding socket is not marked with the SOCK_MEMALLOC flag. Igb driver allocates pages for DMA with __skb_alloc_page(), which calls alloc_pages_node() with the __GFP_MEMALLOC flag. So, in case of OOM condition, igb can get pages with pfmemalloc flag set. If an incoming packet hits the pfmemalloc page and is large enough (small packets are copying into the memory, allocated with netdev_alloc_skb_ip_align(), so they are not affected), it will be dropped. This behavior is ok under high memory pressure, but the problem is that the igb driver reuses these mapped pages. So, packets are still dropping even if all memory issues are gone and there is a plenty of free memory. In my case, some TCP sessions hang on a small percentage (< 0.1%) of machines days after OOMs. Fix this by avoiding reuse of such pages. Signed-off-by: Roman Gushchin <klamm@yandex-team.ru> Tested-by: Aaron Brown "aaron.f.brown@intel.com" Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index a21b14495ebd..a2d72a87cbde 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6537,6 +6537,9 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer,
6537 if (unlikely(page_to_nid(page) != numa_node_id())) 6537 if (unlikely(page_to_nid(page) != numa_node_id()))
6538 return false; 6538 return false;
6539 6539
6540 if (unlikely(page->pfmemalloc))
6541 return false;
6542
6540#if (PAGE_SIZE < 8192) 6543#if (PAGE_SIZE < 8192)
6541 /* if we are only owner of page we can reuse it */ 6544 /* if we are only owner of page we can reuse it */
6542 if (unlikely(page_count(page) != 1)) 6545 if (unlikely(page_count(page) != 1))
@@ -6603,7 +6606,8 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
6603 memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); 6606 memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long)));
6604 6607
6605 /* we can reuse buffer as-is, just make sure it is local */ 6608 /* we can reuse buffer as-is, just make sure it is local */
6606 if (likely(page_to_nid(page) == numa_node_id())) 6609 if (likely((page_to_nid(page) == numa_node_id()) &&
6610 !page->pfmemalloc))
6607 return true; 6611 return true;
6608 6612
6609 /* this page cannot be reused so discard it */ 6613 /* this page cannot be reused so discard it */