Message ID | 20230530114011.13368-3-wuyun.abel@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E80FC7EE23 for <linux-mm@archiver.kernel.org>; Tue, 30 May 2023 11:40:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC8136B0075; Tue, 30 May 2023 07:40:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B765D900002; Tue, 30 May 2023 07:40:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A63FC6B007B; Tue, 30 May 2023 07:40:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 98EE96B0075 for <linux-mm@kvack.org>; Tue, 30 May 2023 07:40:42 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 610E9A01F5 for <linux-mm@kvack.org>; Tue, 30 May 2023 11:40:42 +0000 (UTC) X-FDA: 80846729124.01.B5D1C16 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf20.hostedemail.com (Postfix) with ESMTP id 77D711C0014 for <linux-mm@kvack.org>; Tue, 30 May 2023 11:40:40 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=XUY6RCnc; spf=pass (imf20.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685446840; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7JbrrHsu8KzXBp8abtNpZsLO9DbdsQWsXzCPkkoYMdc=; b=nMO9htCOW+NbrJCEZzHGWM0nOrbuIQfpz5sS4T+cuizhZ23jFtKE7DAxB7yYHl5kACezQl sB27WLxN8ahWngLE1c4KB8zsN6bfdl5pHuyFVRgG/8/GRaOnpQOsXscc0mDLQCt3QM1suS 8dAnICAi0bePHJfxqYEpPFTXZSXh0ts= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=XUY6RCnc; spf=pass (imf20.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.210.180 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685446840; a=rsa-sha256; cv=none; b=aIikwA6eyt8ePXHaQ+Z9pdn9ExIbp7+9SBumXWDpKcdGfU+K5802l99BlA+f7plFVNhu5I ffTTAcWJns/WCgRbUrAKTrnuketFZrLIw35IefIfjWgWq81ycmuqw5tRN9zKglt1VwCGXu QGWHD2gkEz3vNus+WvfCeUHmdypPLpU= Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-64d2b42a8f9so3373361b3a.3 for <linux-mm@kvack.org>; Tue, 30 May 2023 04:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1685446839; x=1688038839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7JbrrHsu8KzXBp8abtNpZsLO9DbdsQWsXzCPkkoYMdc=; b=XUY6RCnc6d+7un5QD7wAiC5Pb7wzmwMI4vRo1wJc4PF0bSz7lhpfuw5w2hLGZ7RA/3 n332Bt+Pe4lAngq6WuKUDTougZGEtz32pIJU7zKJ8QTXJ5ViSZGmOERloMz4QRJYUPXH hsv0l3Khpa0C5xc3NS3GzMJDoOmmkOVJ01kqthm/kqhC6JK6gClKXL3r+jLADDxhzx9e f8NGSVpHLSwGsRh54M1XlrCzSrhEhoysZtz/ipf9w+BGN8Jbp6s9IBTI7fqTjtdWxouD Z3Xw+ieXdkIIETN2bAKZUVTNN+xCGvn93OegJEeKCcXmPMVmn2p4opliPA/APLsYLQee burg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685446839; x=1688038839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7JbrrHsu8KzXBp8abtNpZsLO9DbdsQWsXzCPkkoYMdc=; b=cxGYybndaLgya0JgShhypxsRtaK8b/9XgBwXn0+91ZDHAsgTgpNweVGl5uATS5GK0P /2HBsq1EdTT3fE8qS6Yk3vB+7NP+JIDcuHRuqCy4osqgPjEkmaA7fHkq/OJWSUfdCRsJ uulz4m5T4v1t1dp6RjYiZBh/GTl8WlXXqKGjlDw9fEhwvyUiiD0N5HBBU+xteoXrHRdO YIpJYjvlVZrF1UL8F735IhwmBt2z0hBQDO6q7bBYIojXZei/MIeBALj1XRlri7HxETa5 lRABZ1iWNbAvnrNUMALzVtGQjl/xGaH6kBwwhTR+tp20srX1SviyAS/0P5VjDDq3CtKX n28A== X-Gm-Message-State: AC+VfDxNqqpwOeEqu7iRhxnUKBBphLoddT0MXaxe4OW1w6DmhFlkpZ/z Lxm8qFRiDF9eCTuEWFrDIAQE8g== X-Google-Smtp-Source: ACHHUZ5emuULCTRsl8IAfWUHF9798CEwa7RQFgXH9Xp8NT+z0Zduzv+V05AvK7LnBc/h3VKpGHIubA== X-Received: by 2002:a05:6a20:9151:b0:10c:71de:5dc5 with SMTP id x17-20020a056a20915100b0010c71de5dc5mr2593508pzc.30.1685446839327; Tue, 30 May 2023 04:40:39 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.147]) by smtp.gmail.com with ESMTPSA id j20-20020aa78dd4000000b00642ea56f06fsm1515103pfr.0.2023.05.30.04.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 04:40:38 -0700 (PDT) From: Abel Wu <wuyun.abel@bytedance.com> To: "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Vladimir Davydov <vdavydov.dev@gmail.com>, Shakeel Butt <shakeelb@google.com>, Muchun Song <muchun.song@linux.dev> Cc: Simon Horman <simon.horman@corigine.com>, netdev@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Abel Wu <wuyun.abel@bytedance.com> Subject: [PATCH v4 2/4] sock: Always take memcg pressure into consideration Date: Tue, 30 May 2023 19:40:09 +0800 Message-Id: <20230530114011.13368-3-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230530114011.13368-1-wuyun.abel@bytedance.com> References: <20230530114011.13368-1-wuyun.abel@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 77D711C0014 X-Rspam-User: X-Stat-Signature: iiwrr3s3ur5c77cxbzbhrfnzyk8y7okk X-Rspamd-Server: rspam01 X-HE-Tag: 1685446840-834695 X-HE-Meta: U2FsdGVkX18/06ANnjQRaPZkwa6vqUv8Kn/E12mpPS1fofZDuQ2fTLtqAHONjy4ZyBSt1YB/D4e9MdMQA81mblK6pZWZQwNti6NxqnoEOLr5PT/bSuKstheUDxz6mwfyulSx0xDSZJNilj9rKItB3W2M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1IFG6upC4fpTtCpcVuZ/zdsI04+ucFLMysITf99W0t8HjDDBR8c7/ozILHGmsAwAvgiZSjmXauzVxTqUbEXF4uwiwHiQ4khRS6b2cprcE3eTgcWkjGzDxZa6PCPl2Rpg2EYvukDqbgGXOLGj91WzaMu5U36pX1TOBOYeyKWG9EoKbiT6Otcg2RTrGTDsj6KjMDHZqCNkdwcwyFzN2vpC5o7BKeUSlr8LHeUgY1g1B4Hy+JpuNfq/errQOuf8kN4OVNjydw+wyGFFcoFZ2z3xtPVdQipCCm/yLHU7KJmr5fJBxfv3g8qGugWlzazuJ1e+7xPVkC5n8zut2gg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
sock: Improve condition on sockmem pressure
|
expand
|
diff --git a/include/net/sock.h b/include/net/sock.h index 641c9373b44b..b0e5533e5909 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1411,13 +1411,11 @@ static inline bool sk_has_memory_pressure(const struct sock *sk) static inline bool sk_under_memory_pressure(const struct sock *sk) { - if (!sk->sk_prot->memory_pressure) - return false; - if (mem_cgroup_under_socket_pressure(sk->sk_memcg)) return true; - return !!*sk->sk_prot->memory_pressure; + return sk->sk_prot->memory_pressure && + *sk->sk_prot->memory_pressure; } static inline long
The sk_under_memory_pressure() is called to check whether there is memory pressure related to this socket. But now it ignores the net- memcg's pressure if the proto of the socket doesn't care about the global pressure, which may put burden on its memcg compaction or reclaim path (also remember that socket memory is un-reclaimable). So always check the memcg's vm status to alleviate memstalls when it's in pressure. Signed-off-by: Abel Wu <wuyun.abel@bytedance.com> --- include/net/sock.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)