From patchwork Sun Jun 25 14:28:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Wu X-Patchwork-Id: 13292000 Return-Path: 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 701A7EB64DC for ; Sun, 25 Jun 2023 14:29:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC04B6B0072; Sun, 25 Jun 2023 10:29:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B48ED6B0074; Sun, 25 Jun 2023 10:29:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E9966B0075; Sun, 25 Jun 2023 10:29:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 908C06B0072 for ; Sun, 25 Jun 2023 10:29:39 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 64D69AFA7E for ; Sun, 25 Jun 2023 14:29:39 +0000 (UTC) X-FDA: 80941503678.01.AF50D80 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf14.hostedemail.com (Postfix) with ESMTP id 91B26100003 for ; Sun, 25 Jun 2023 14:29:37 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=R76JOrQ1; spf=pass (imf14.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.216.49 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=1687703377; a=rsa-sha256; cv=none; b=PPvSGgrfKrV50JlF+fyO0un1FGYecjcTWKcl6U7Px1l9P78rsB2ZAkqHi6p0H9jKmzt7oz rR06gpVEc6+xQqqoQihpA92r/oiOXtKK9rWfUIclUBbNU2BabGZEsFbruh4veSee41ySnP 5SF2psXWvxfNtRbOm89/EnDYjXdqr3k= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=R76JOrQ1; spf=pass (imf14.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.216.49 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=1687703377; 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=VJ3Ti/D8S3EnbGsOdGwNu9kTjaPf3p14ktWAeREbOBA=; b=m01hJ5S1BWX7zwDB5wtY8ynboLWwodhzuTSHmlyugt1yCtlDFzzEyJBul3jy2+0M8iofhw 8vnoBFYeYcNCHrXeqqH9g+9m6xm/K55TLTgrQr7qcTqWkuRqYcqp83wj3nHePa8oyXUiMO JhpqC4ZEpu8NRmMmwlsVmJu9VmMZVCg= Received: by mail-pj1-f49.google.com with SMTP id 98e67ed59e1d1-262e839647eso356049a91.2 for ; Sun, 25 Jun 2023 07:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1687703376; x=1690295376; 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=VJ3Ti/D8S3EnbGsOdGwNu9kTjaPf3p14ktWAeREbOBA=; b=R76JOrQ1dPo/73QodWvkhogr6Xt3xbQEkJkqTXvgiKUM710so38qio0hXQtzJsCbye O64gRUD8e4b7zMBLCa8BCFkjiCVBuoelt8Lz44yLSCENsHauLJ5VAqcybrk7HI43XjZJ xw1A0f0eaZzKR/Ar36Kqyfhr3MjK8BgRBvHCT8PoFVrsUtlG8ClolFEc1xl4ajF7FpQ4 jG1bDDFxEkF4PmsG5MN5jtqcIgZemQAg42B1hTpu7CQnS5UpXJ+RqiyD5oKIhLIk3DKX 7lQZBR+vpTUq2cMa25g5g10YhFZV5+0w3BEdk2HvIp0mOd/DI175m+zpOf8KM/i3awwh RfiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687703376; x=1690295376; 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=VJ3Ti/D8S3EnbGsOdGwNu9kTjaPf3p14ktWAeREbOBA=; b=P2oOdeV7EhfA8vUxGZD7SGCIOsWGGJhe3OTjaMs6dtEJuC+aYl2y2gwNy1puTHyigV qBCfqrvT2Lzkpg+q/w/+u16rshbjBw1POrGTbJcG9/t5uIwzm+91/HoUn2fhlNkWe1Ac sDZcbUbfDA31voZHVsjblu64JkmLIYDtNeZ0t0o3dRhuwsDzL3PrTP7+IO7ZN913uIFa N+3EjzLwstG3K+P2TJHPpIzwkkGAINq0c4orUAEiwOQAhsYcOys/fIpPQ1TSkC4WdTsT m9vbG0ACNI0nONQ3kxYBUqQTJXITjQ54Yh5G+Bg6Q/896+ItplgcYgkii4/nXHa/jmG7 vXvQ== X-Gm-Message-State: AC+VfDx4is8kZGMfuvGWEZ6XWRCyq0E52NqZpPSnE4CHmjiBrLlBApya PyJvZiIhwl7dDbcYH0NdfQOR/w== X-Google-Smtp-Source: ACHHUZ4HqtHP/zbYUeJtO1vXlwl9dfUGTA5Z2y9D1QGuKBCZoms2r2/THr49mB8kg8U5Z9mw09DG5Q== X-Received: by 2002:a17:90b:4b4c:b0:25b:eeb3:adc4 with SMTP id mi12-20020a17090b4b4c00b0025beeb3adc4mr26482189pjb.15.1687703376138; Sun, 25 Jun 2023 07:29:36 -0700 (PDT) Received: from C02DV8HUMD6R.bytedance.net ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id 29-20020a17090a195d00b0025ef39c0f87sm2980744pjh.0.2023.06.25.07.29.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jun 2023 07:29:35 -0700 (PDT) From: Abel Wu To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , David Ahern , Yosry Ahmed , Yu Zhao , "Matthew Wilcox (Oracle)" , Kuniyuki Iwashima , Martin KaFai Lau , Alexander Mikhalitsyn , Breno Leitao , David Howells , Jason Xing , Xin Long Cc: Abel Wu , Michal Hocko , linux-kernel@vger.kernel.org (open list), netdev@vger.kernel.org (open list:NETWORKING [GENERAL]), cgroups@vger.kernel.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)), linux-mm@kvack.org (open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)) Subject: [PATCH net-next 2/2] net-memcg: Remove redundant tcpmem_pressure Date: Sun, 25 Jun 2023 22:28:11 +0800 Message-Id: <20230625142820.47185-2-wuyun.abel@bytedance.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230625142820.47185-1-wuyun.abel@bytedance.com> References: <20230625142820.47185-1-wuyun.abel@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 91B26100003 X-Stat-Signature: fa8eetz7en5hercwi67ty5yfj5ddbnb1 X-Rspam-User: X-HE-Tag: 1687703377-968872 X-HE-Meta: U2FsdGVkX19fbX0qXtrKOO2h9r5CR3yytj68kAEHgR91oqXfnRA3Wex7Eb9axzIyVnzEsvFG5f1x2rbjA6epViLiYjeMIvHfA7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lQdBV6jE/Az3fWinliYTVTLox/t4P56LGQpQ9WYjYRaY0+9bLdW4shDe 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: As {socket,tcpmem}_pressure are only used in default/legacy mode respectively, use socket_pressure instead of tcpmem_pressure in all kinds of cgroup hierarchies. Signed-off-by: Abel Wu --- include/linux/memcontrol.h | 3 +-- mm/memcontrol.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 9b1b536b4ec9..05e9fb5fa08d 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -288,7 +288,6 @@ struct mem_cgroup { /* Legacy tcp memory accounting */ bool tcpmem_active; - int tcpmem_pressure; #ifdef CONFIG_MEMCG_KMEM int kmemcg_id; @@ -1744,7 +1743,7 @@ void mem_cgroup_sk_free(struct sock *sk); static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg) { if (!cgroup_subsys_on_dfl(memory_cgrp_subsys)) - return !!memcg->tcpmem_pressure; + return !!memcg->socket_pressure; do { if (time_before(jiffies, READ_ONCE(memcg->socket_pressure))) return true; diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 4b27e245a055..76c4e5c6e558 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -7337,10 +7337,10 @@ bool mem_cgroup_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, struct page_counter *fail; if (page_counter_try_charge(&memcg->tcpmem, nr_pages, &fail)) { - memcg->tcpmem_pressure = 0; + memcg->socket_pressure = 0; return true; } - memcg->tcpmem_pressure = 1; + memcg->socket_pressure = 1; if (gfp_mask & __GFP_NOFAIL) { page_counter_charge(&memcg->tcpmem, nr_pages); return true;