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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fcr6xQ Gi1id67e BBP1bK4tXnXoq6yxZh3jlWEbxX9ID4rvYYc3PmlhZd2m1acFj4UCayHeMkhpdUcfeLhysFPOgj3KTb+wBh0l9J53p1sbKlfnGoZVBMLnDwmYm/gIOnIZPkc1yWbCRTg6qXcLsvcRHabzBK+TMLF8oSlJLX2xtaiTt+1lhj6vbZiim66YVTb0P17w3Fgu5lXkgBr2f7vg0Df82oBsrM8VGUQMMv2+DCboSaIoQJOu5nUgB/LVNhWJ6bYx4nvRPBTVWZeZewT3limTWOA2Cu6ZzXuDLNZp599h9ylzo6XpQH2OlyQwVkzCWv9qEZit+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);