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); From patchwork Fri Jan 24 04:38:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13948899 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 4A221C0218C for ; Fri, 24 Jan 2025 04:39:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90DA428002A; Thu, 23 Jan 2025 23:39:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BC51280025; Thu, 23 Jan 2025 23:39:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75E2728002A; Thu, 23 Jan 2025 23:39:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 538C4280025 for ; Thu, 23 Jan 2025 23:39:15 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 03819C0C2E for ; Fri, 24 Jan 2025 04:39:14 +0000 (UTC) X-FDA: 83041091070.02.B52F2BB Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf17.hostedemail.com (Postfix) with ESMTP id 2333540008 for ; Fri, 24 Jan 2025 04:39:13 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=TiqY5Awq; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.52 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737693553; a=rsa-sha256; cv=none; b=AmR0ER7jr+5ODei+FSThBqG0l5efKEb8wFcBHqmsYO5Fy+R481ATK5yA6ZMPAa38GubonQ PhbTB2u92klNFAFb0ET7N26gukqykqBfUfryA0p0gUs9mytF5ci/IeE+uBGM9TMwSUgzmj eJ8k9Gnlllw4utcDdq9cUs+p6Gv0pt8= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=TiqY5Awq; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.52 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737693553; 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=qnF2WFHU7nDHUVLzoV/yB+mhbLnUF5NDJKTsZnkB61Q=; b=XXc+v8ElSHJmSDFD9iCo20JSlm++cdaVSyWlyk3pM3bDh5P5j3a0SPb4xFfVVY4Mql0fnM R5l4IDgcrW4Hrinrfw9UQQ3A6QPi9wlMtiZivon+N1cRzv18nLUAu8dehEWN7/CxJbgBtW 76Y87Wo1gEPNpdBzq6vW8a+5/cz1WTo= Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6d8ece4937fso14673216d6.2 for ; Thu, 23 Jan 2025 20:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1737693552; x=1738298352; darn=kvack.org; 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=qnF2WFHU7nDHUVLzoV/yB+mhbLnUF5NDJKTsZnkB61Q=; b=TiqY5Awqm5HU95w8YQJ6O4c75fhiKpUv9PtNcnTT5wDqrwGxCLEjjs9wpiqBTLndt+ fFbOOWnAaL38yPPWImj2VC8ycuW7PebhXwdgX13EWll+CtnOTnRHqGd6hgP0uFNuSm1r M4Bkwd9rLqqcAG5Zpdl0Gc5L7+UH4HVw5OOuSTx/N+Aobu1odIwaW8vVeA5Vyh5WlsLJ 9quNDO0KCT6k0Kx/ysvcunkqwW5eHqry291qUsa+SSUR9gkgWXvyp+QF9j+b1SFm7PNW DkQ3ltJBFo8qiPXbojAtgSO9v9fdfP5BsttFPDPeibgtf3QgUDHPF+RQt04EBbTKQV8X tfVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737693552; x=1738298352; 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=qnF2WFHU7nDHUVLzoV/yB+mhbLnUF5NDJKTsZnkB61Q=; b=C2g+gdoTMHft1af8AmsPY9ibgHU7JgO3wZLAQ75oB3C6d1lTlWfl78msxc4uYmsIK5 cmVW1VHNMz+2L3FlmBMxYSriTLvmUu7GwOTOEQgDc7jdpiTaP1Riwgcxh90GCt1xL1Dp EFyfJXKiaTE5b/CqTAwoBcAmPuHONSoH8ES7ifBJzCHd5/NIZqvrT6dkYbaZSO02fh3B 82e00XMkwmA0IqMMQEGouQqKs4O8pXDCu6Bhf6D1pr+ns5Cg2Nn0PISkVNifX2k8Wdbm LRE4h2BPcnonz7Sw60JGNBnIzhwXf4IvPgecdHpUVJPV+exp0FILEuFM10YBy2YEB/TJ ybfA== X-Forwarded-Encrypted: i=1; AJvYcCW9jTkYiNnMRyUsyISyLZiVlWIZ7wWhdIfZt9gLOTwBvA6E48sfTs4Dm3y+qzMqurZ9O+Dc7kRHag==@kvack.org X-Gm-Message-State: AOJu0YzyDQbLnja8OhGl3UW6tZMyF2Pi45vysu/oDNS5x702fqdpSLDx pBXj0/jIctFjCuE02BttokZAl9AaUNb2fZNcv75bqL0R1qEct+IazQFJVDE5grY= X-Gm-Gg: ASbGncuRC6HbBgQuJ/2tr4wpcZSwIWDfubZOoYnVAizEA1yQzVsamSH32U5RgngtWbH 4OYXnmTirOxTBGk3cfqWVqliUPRNO2YvRz5mwd9AB0MAQoKcradwhlfpa7U1uP+pZmO4+Yblqxm fxoT1aK29vDfyiBPI88cqoO7WqEQ1985vDU3JfPlaHUOp8T/4JHPcKfylkCwYIqFoJXrHb2Dr3t AtIAJSyW65FOBRZAEVXMGurwk9ltEv5VK515uRv9NzBFjrAWVCLdPrdLhx4p1X8bu9Ebs8i5h7U ibo= X-Google-Smtp-Source: AGHT+IF0FE+5UCpTw4hYqqLVu1wQ2oa1lJMAASSqMbEe84oBKZFcwsMVsPJAoGxLDr/qRFkSg/SVhg== X-Received: by 2002:ad4:5961:0:b0:6d8:7e03:c427 with SMTP id 6a1803df08f44-6e1b21cd940mr423948956d6.20.1737693552056; Thu, 23 Jan 2025 20:39:12 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:cbb0:8ad0:a429:60f5]) by smtp.gmail.com with UTF8SMTPSA id 6a1803df08f44-6e2057a87bdsm5151006d6.77.2025.01.23.20.39.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 20:39:11 -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 2/2] mm: memcontrol: move stray ratelimit bits to v1 Date: Thu, 23 Jan 2025 23:38:59 -0500 Message-ID: <20250124043859.18808-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250124043859.18808-1-hannes@cmpxchg.org> References: <20250124043859.18808-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 2333540008 X-Stat-Signature: b1zm9hzjkx5hczkb4fz5idkogfujrubq X-HE-Tag: 1737693553-731505 X-HE-Meta: U2FsdGVkX1/5T5zC/k1/VYNZh3X3aL5dge9y5hUW9ATqXGgfzzAgzRiP9X2nvXqZ7KvuVH+shHq5aiUY5i+YSDFfeIizLz7xMu+6YpG+JL6tAN8Aut1PsmRDkaU8QIwJdZwLV7SJp/NE/ephf69PUyJTmAnjtyPHQzUGARj1jsExAuBJL94Rru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3limTWOA2Cu6ZzXuDLNZp599h9ylzo6XpQH2OlyQwVkzCWv9qEZit+PTB0QK6oC5FZ3ORog/UB/Fkc3ZNwruig07fvzORLQUmfXzT1ap5dMBRlt4Fo8iZ0tyWgqPtmMKVKPSf28z8Eay9BMIFzkKc2Ifp5fFauI8VSsMknMnM1R+YHX+WZaPRzAJkBXXT+ 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: 41213dd0f816 ("memcg: move mem_cgroup_event_ratelimit to v1 code") left this one behind. There are no v2 references. Signed-off-by: Johannes Weiner --- mm/memcontrol-v1.c | 13 +++++++++++++ mm/memcontrol-v1.h | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 2be6b9112808..6d184fae0ad1 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -490,6 +490,19 @@ static void mem_cgroup_threshold(struct mem_cgroup *memcg) } /* Cgroup1: threshold notifications & softlimit tree updates */ + +/* + * Per memcg event counter is incremented at every pagein/pageout. With THP, + * it will be incremented by the number of pages. This counter is used + * to trigger some periodic events. This is straightforward and better + * than using jiffies etc. to handle periodic memcg event. + */ +enum mem_cgroup_events_target { + MEM_CGROUP_TARGET_THRESH, + MEM_CGROUP_TARGET_SOFTLIMIT, + MEM_CGROUP_NTARGETS, +}; + struct memcg1_events_percpu { unsigned long nr_page_events; unsigned long targets[MEM_CGROUP_NTARGETS]; diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h index 6dd7eaf96856..4c8f36430fe9 100644 --- a/mm/memcontrol-v1.h +++ b/mm/memcontrol-v1.h @@ -28,18 +28,6 @@ static inline bool do_memsw_account(void) return !cgroup_subsys_on_dfl(memory_cgrp_subsys); } -/* - * Per memcg event counter is incremented at every pagein/pageout. With THP, - * it will be incremented by the number of pages. This counter is used - * to trigger some periodic events. This is straightforward and better - * than using jiffies etc. to handle periodic memcg event. - */ -enum mem_cgroup_events_target { - MEM_CGROUP_TARGET_THRESH, - MEM_CGROUP_TARGET_SOFTLIMIT, - MEM_CGROUP_NTARGETS, -}; - unsigned long mem_cgroup_usage(struct mem_cgroup *memcg, bool swap); void drain_all_stock(struct mem_cgroup *root_memcg);