From patchwork Fri Jan 24 04:38:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13948898 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 E8821C02181 for ; Fri, 24 Jan 2025 04:39:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B4D5280029; Thu, 23 Jan 2025 23:39:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 364B5280025; Thu, 23 Jan 2025 23:39:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22D93280029; Thu, 23 Jan 2025 23:39:14 -0500 (EST) 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 01BC2280025 for ; Thu, 23 Jan 2025 23:39:13 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 89778C0C2E for ; Fri, 24 Jan 2025 04:39:13 +0000 (UTC) X-FDA: 83041090986.28.F436C5C Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) by imf03.hostedemail.com (Postfix) with ESMTP id 8B49920005 for ; Fri, 24 Jan 2025 04:39:11 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=Tf9i3oY8; spf=pass (imf03.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.41 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737693551; 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:references:dkim-signature; bh=LA98XB9LYD/MipEPJEpEr2dcKbFDev2YEJD5nlY7UfU=; b=gjYkSUAc+sY6HYJQmMe7/hXsyMm6O6zrDx17M5ogzzNqFZFFfEiIH6SU3cue6mpLIoKbzd 0Ob1+RHl2jYKYd9IzVOcaeaenwiZHz7XEEteuQMgeNAGwUiPyH53hq9apw9XoZfY1VPpxR YRfewVWsFBNtuNrWPXseJYaYOXZvzIE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737693551; a=rsa-sha256; cv=none; b=JYu8LP0IFXr4B5HA9TCiECtLi4C25bpitcUn4y2TFMLCoCyBZPEV4EuYgAAbg32jdraGMY lzqGMqBwBNzlbfnSmN90nHXiB8c7m8zZWYMvARSWGtwsirw/2+y86kQv/ltKy9nBaAZ9zU gZIY4k6L8o/WHazPf04YbLDT4cKLB80= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=Tf9i3oY8; spf=pass (imf03.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.41 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-6dd15d03eacso17440146d6.0 for ; Thu, 23 Jan 2025 20:39:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1737693550; x=1738298350; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LA98XB9LYD/MipEPJEpEr2dcKbFDev2YEJD5nlY7UfU=; b=Tf9i3oY80mgc+GRqcO/NEyc25ozn5oTrz+vtpQ7+RBMuCp5tBZbCHhx9BhdhP4BELq CLxWcWKB4XcTtMVVcSOfzAJ4IGEMD3uwPAv2Zofvk+SGr/FyzxT+MJthr6spjdZUXFyK pq2YxpYmHz+RkWjtky1RpDp+x0BmzsnCeG7U1z8ONC7QBkAP9r7zF/J3htoDAY8e+nwx QZkP22liOKuQugTgYlu27xB60GAN2DDd4bfaasGDrHP870jjn7ule6sWRn7jV6zAdnK6 B17lSV8rwdbTRzNUreHVbPiAoVxn66gazLuHNQdnevfnRVNn+v/BPtjAaTN1UWi9Oely pnDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737693550; x=1738298350; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LA98XB9LYD/MipEPJEpEr2dcKbFDev2YEJD5nlY7UfU=; b=Zq1YwTSi33/UAd8OF5JOoMeDgfiMT9egxjCKtB2G2Zeb+/F6SOFxGFFi6m4HSH9rBZ XtONG9zb5NPYkAMa2s4vsg2j5qxEFDOp9jjpRLr5c1ts2GJXlaF33n+19mSrUQlQFGBs OuH+VsU1l8wfvcoo83wfzfnoILVC8bbjqgqZ6x6fTDpo6+RK7s98Sydoqcy9WTxWYB5K dCYciNf65yC2w+fYzRe9yZmUorWy1niNIiNoP7/VtnE6WH89gzYCh3s4GDaRYBFjXVgs sYWuHG9nMcNK9CR8mlI/zCZIk0w2no0+eDmfsra1aXiMD3FTreMLOztfkAb/xMHvpszm t/3A== X-Forwarded-Encrypted: i=1; AJvYcCW11GhAYsksq5lfz2ytQ4ieCuPfqTgbqYMmnfCMojdcu/4Jmq/32y7tt6XMthu08W/Q+uNUa/8a/Q==@kvack.org X-Gm-Message-State: AOJu0YxjYXK4ucwH2wxlWNc1h1YVEML9ltNfqMKacYIv6d2VbESZOpN/ SCJrPCsOLHZlIBmTMHxJhhkYVteP5AnZO1FX0IraPjrd51gwLbaZOboqIMMw0oQ= X-Gm-Gg: ASbGncsmZlJhqRdyJCg3Dt7JQQ9Uxru5069pe9aJt6mWPUh4twV4NnuPXrpv4UvFvJG eC2uQ0ChCMdReoBGjrROoMV3DCzjMmm7WCv6WXbu0cNrzOjdvv8b03Gon+PFbD3pjpUfmEMn+iy e/HK9xm0qDRR49a3vCsM1ISDI46uiSDSiDbdh1uLaxKS3xM/njVokl2xCJt9B7FBNCdBbG6fMeT WgxprdLZ1LgqBPbZbfsrMJCNgv/XQ6AI9nPLH11913/uOfbIsfqqGI93vWuZPVJ5Kgoy5uEOmlf R5s= X-Google-Smtp-Source: AGHT+IFNV83+n81ZC7OSsymBf3rQHfUmDNRkj6S/SLoyQgdTGlbAJ2mV0G99gsb8+lXqSCYHJomFEA== X-Received: by 2002:ad4:5d4a:0:b0:6d9:2f70:2dab with SMTP id 6a1803df08f44-6e206253519mr36862156d6.16.1737693550460; Thu, 23 Jan 2025 20:39:10 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:cbb0:8ad0:a429:60f5]) by smtp.gmail.com with UTF8SMTPSA id 6a1803df08f44-6e2058c2b76sm5148046d6.107.2025.01.23.20.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 20:39:09 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mm: memcontrol: unshare v2-only charge API bits again Date: Thu, 23 Jan 2025 23:38:58 -0500 Message-ID: <20250124043859.18808-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 X-Stat-Signature: ejc8rup68pt9jfrnornmub8ixkc99rgq X-Rspamd-Queue-Id: 8B49920005 X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1737693551-774765 X-HE-Meta: U2FsdGVkX1+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WDhI26xhQHaWAD66nhYgL5x4xrA8Mu2B4E1fT6s9XTvcGOJZjqO5vQg4V8V6vcLwq1MOgtc8g4UjV1h0DhbUNS/YIX5x5KpcC9vgaPSko3vJSz3iEOYQzB2MspjA4ZR8T8NS+RU3t8epCqNGrGUnSv8M0H/tmwEooYzUztfetz/cF39vVlTMHnUb5PTFc6U60Ev4ozyMEwP4CcSceAhUdZ5vC9OBdlf/ACoiyneqgrAexYJJofwYLpqEXr2Jl0dLXuUtsjcXX5e7zMoqDZjB2yC/yXLGRW7/jGB8Nk0N7HB373ZntSpHC3KFoKdauwW91ziDqKuWF8NC/xggAv3kcrLrurAjZvgLF/G6i80 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: List-Subscribe: List-Unsubscribe: 6b611388b626 ("memcg-v1: remove charge move code") removed the remaining v1 callers. Signed-off-by: Johannes Weiner --- mm/memcontrol-v1.h | 15 --------------- mm/memcontrol.c | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h index 144d71b65907..6dd7eaf96856 100644 --- a/mm/memcontrol-v1.h +++ b/mm/memcontrol-v1.h @@ -7,21 +7,6 @@ /* Cgroup v1 and v2 common declarations */ -int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, - unsigned int nr_pages); - -static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, - unsigned int nr_pages) -{ - if (mem_cgroup_is_root(memcg)) - return 0; - - return try_charge_memcg(memcg, gfp_mask, nr_pages); -} - -void mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n); -void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n); - /* * Iteration constructs for visiting all cgroups (under a tree). If * loops are exited prematurely (break), mem_cgroup_iter_break() must diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 46f8b372d212..818143b81760 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2198,8 +2198,8 @@ void mem_cgroup_handle_over_high(gfp_t gfp_mask) css_put(&memcg->css); } -int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, - unsigned int nr_pages) +static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, + unsigned int nr_pages) { unsigned int batch = max(MEMCG_CHARGE_BATCH, nr_pages); int nr_retries = MAX_RECLAIM_RETRIES; @@ -2388,6 +2388,15 @@ int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, return 0; } +static inline int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, + unsigned int nr_pages) +{ + if (mem_cgroup_is_root(memcg)) + return 0; + + return try_charge_memcg(memcg, gfp_mask, nr_pages); +} + static void commit_charge(struct folio *folio, struct mem_cgroup *memcg) { VM_BUG_ON_FOLIO(folio_memcg_charged(folio), folio); @@ -3368,13 +3377,13 @@ static void mem_cgroup_id_remove(struct mem_cgroup *memcg) } } -void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg, +static void __maybe_unused mem_cgroup_id_get_many(struct mem_cgroup *memcg, unsigned int n) { refcount_add(n, &memcg->id.ref); } -void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n) +static void mem_cgroup_id_put_many(struct mem_cgroup *memcg, unsigned int n) { if (refcount_sub_and_test(n, &memcg->id.ref)) { mem_cgroup_id_remove(memcg);