[Devel] [PATCH vz7.83.x] net/memcg: fix check for OVER_LIMIT in socket memory accounting
Konstantin Khorenko
khorenko at virtuozzo.com
Wed Dec 12 18:01:10 MSK 2018
memcg_memory_allocated_add() check for charge success is inverted:
page_counter_try_charge() return 0 in success.
RedHat backported commit 8c2c2358b236 ("net: tcp_memcontrol: properly
detect ancestor socket pressure"), but forgot about
6071ca520106 ("mm: page_counter: let page_counter_try_charge() return
bool") which reverts return values for page_counter_try_charge().
Until this patch UDP traffic simply dropped because of incorrectly
detected memory pressure.
*parent_status = OVER_LIMIT;
memcg_memory_allocated_add
sk_memory_allocated_add
__sk_mem_raise_allocated
__udp_enqueue_schedule_skb
__udp_queue_rcv_skb
udp_queue_rcv_skb
__udp4_lib_rcv
udp_rcv
ip_local_deliver_finish
ip_local_deliver
ip_rcv_finish
ip_rcv
__netif_receive_skb_core
__netif_receive_skb
process_backlog
net_rx_action
__do_softirq
call_softirq
do_softirq
irq_exit
https://jira.sw.ru/browse/PSBM-90144
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
include/net/sock.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 18d318988cdd..1b86b37fe884 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1261,7 +1261,7 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
struct page_counter *counter;
memcg_charge_kmem_nofail(prot->memcg, amt);
- if (page_counter_try_charge(prot->memory_allocated, amt, &counter))
+ if (!page_counter_try_charge(prot->memory_allocated, amt, &counter))
return;
page_counter_charge(prot->memory_allocated, amt);
--
2.15.1
More information about the Devel
mailing list