From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B7673375D0 for ; Tue, 6 Jan 2026 10:26:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767695166; cv=none; b=miZ/9bw0dm5ZsVNrkY5/7yQ/O9cKiHpG95eMMqoymLJVn8wDasJcB0LNac6K8GpzJYwqx+YnVxFRrOwdKn6mmNCrng1w+veyGzLrjP1xzeEjk+m8HBAp+7Tu8nNyHibsW9enjEazrOtQLXJs1FSuDFlmGVk9UDpt1j0f2Tl+Bko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767695166; c=relaxed/simple; bh=AaFPGrqWLPKAMN+xtCBNy3vJEkpmfJZ2G74GxmBelnc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ByQfDfIwkP2nLBmkfDtKW8jQ0D8frczlmBb4v3mPY34l0gkaOe1GmgpUM1mxwKhEr1iSZdn3jDUt341nGBfTZ3PJv0SoC60qsg4SXUxxsb52nWrUOimOcw8a1ShK1sOZNpxR6b7MraZhvIXaqacKpCSe1B/OaVHHE19BhQ+4XKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=MTmd0Lhv; arc=none smtp.client-ip=209.85.128.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="MTmd0Lhv" Received: by mail-wm1-f65.google.com with SMTP id 5b1f17b1804b1-47d63594f7eso4897865e9.0 for ; Tue, 06 Jan 2026 02:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1767695161; x=1768299961; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=yrYlgSs3aSLf4OO6JdIXAa9ZB/yG8lk++eER1aaE778=; b=MTmd0LhviehGKCFFyXPkRG9TmpIJwnCk6+yGlBVips1JPni3VRBCsXobrqjv9f/qDr ThBWM0T24jNgg+pUlsmzJJkF9wfGd/v56ggLehL6aNSgNKulh9MGmBfRBoVNmb+QpU82 d/cV+3jso8Peylu+LT1B8rNedQWnohrhrlSWegYigGNLi/QcX9L8Jv9GdYG9wswDO5fL 9/MGETerdl854N85tsvkQQaS1ivRFqIF5A6D5MZOqdGoidXHY0M9RNSepDdI2ZqfewX7 NHAgeEblopxhus4BNu9z46kbXWng0to/PJsDjlal3vpLXBXXQ4diB6Mdx0fSRi4nnSlM PAwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767695161; x=1768299961; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yrYlgSs3aSLf4OO6JdIXAa9ZB/yG8lk++eER1aaE778=; b=vcJJQFvW/Ast5CVaS9NuUygEZoFZlmCbPiYtFqKlySVFlq1Ob21wCSigUWYiJp7wJh XktMrtKq5mQAPZ74ztCFNk4F9YPT3af8g9MbgCXXUkwAl/1uTnv99Zhqj/9vDKWIehom YyB9xP0oiVLGK9aLznRMYfl2+4aheALv8EE1yzCKkY3tQv+5ZyViZXBR+lCt0ED4VUTT INmDW77QKE7XI0dAPbHWZQaYwOZo7jFGP1tY0+UEAwUtpXshV/cW9ry0rTGuKpUsf1n2 GZYnj1rBszg3Xyyos0qal7H0oO02+d1RcW1nHFEAty4bLlF5tn4iMjaLlzUrk9ONPWff wwZw== X-Forwarded-Encrypted: i=1; AJvYcCWJwDgRl2Dz2WD5xxM+3hPEX9PzxN1OB+md3Ij7HbeBiCSIlZE+JibqpCSZ9vUFk5TiFlzbExF1k6a9ODE=@vger.kernel.org X-Gm-Message-State: AOJu0YzX9XhPz6gj+seZ4DbhhWq0snJQuwRnra/GkMyjNWUpbGtr07gu s8AWXb6FTbu7UWXIBtz2jn7voxbXat3/6K5PMMcRQlQvUQ5lMOFbQk46Lk7bGS1l06c= X-Gm-Gg: AY/fxX7knN7NMmkYfmqKQhhVpcBjhg4wY2VSKy+ZEyoXkKCx7aS0Gj1heAia68DCTdJ r+Whiv66SnYXGdo0p5S3iJGrszL9YFxtdOQWdz/TBO7SrSTKvkPGDke7mrQnfHtkYOohFkdkjpU XAX4e84MPxLxuh+zaIPkpCvgodT/Htk6GU1rG0M8HNrIhqX4DGINahJGgDU8J27n9ZZWR8Or52I q6/Ms3UNXjqO+hix0TNueH5BBGZMVPRAy1uunE0n+pUPV6NL8o9qIKHypqYZTcCUuWqlMtvsXAJ sMzjZeKDSgT6JhK3dB3eg+1IgBmSeFUinJErtjARfeo6GDN/oZrSJY2LE82Cimqn7W1t5wy4pKN xXs2oCMt2Iq1D2wBW3ktrmTNu7RpezeAqExtRe/ndlydqNJCPsS9lBMzcUHR98GYjw0VzU4OZvU VuyANwq1/BTzbEAVLaHY3IAcbnnK7Qd2/cMR0= X-Google-Smtp-Source: AGHT+IFb++SFH+rzxjUyOLzVtbAwCNpIM3DiqRn405rjEU6hdyHt22A9JWXC6Ev1mua/rT+52Ubpuw== X-Received: by 2002:a05:600c:3484:b0:477:7a78:3016 with SMTP id 5b1f17b1804b1-47d7f06dc14mr27492355e9.8.1767695161240; Tue, 06 Jan 2026 02:26:01 -0800 (PST) Received: from localhost (109-81-90-116.rct.o2.cz. [109.81.90.116]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd5df939sm3571930f8f.21.2026.01.06.02.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 02:26:00 -0800 (PST) Date: Tue, 6 Jan 2026 11:25:59 +0100 From: Michal Hocko To: Shakeel Butt Cc: Andrew Morton , Johannes Weiner , Roman Gushchin , Muchun Song , SeongJae Park , Meta kernel team , linux-mm@kvack.org, cgroups@vger.kernel.org, damon@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/8] memcg: separate private and public ID namespaces Message-ID: References: <20251225232116.294540-1-shakeel.butt@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251225232116.294540-1-shakeel.butt@linux.dev> On Thu 25-12-25 15:21:08, Shakeel Butt wrote: > The memory cgroup subsystem maintains a private ID infrastructure that > is decoupled from the cgroup IDs. This private ID system exists because > some kernel objects (like swap entries and shadow entries in the > workingset code) can outlive the cgroup they were associated with. > The motivation is best described in commit 73f576c04b941 ("mm: > memcontrol: fix cgroup creation failure after many small jobs"). > > Unfortunately, some in-kernel users (DAMON, LRU gen debugfs interface, > shrinker debugfs) started exposing these private IDs to userspace. > This is problematic because: > > 1. The private IDs are internal implementation details that could change > 2. Userspace already has access to cgroup IDs through the cgroup > filesystem > 3. Using different ID namespaces in different interfaces is confusing > > This series cleans up the memcg ID infrastructure by: > > 1. Explicitly marking the private ID APIs with "private" in their names > to make it clear they are for internal use only (swap/workingset) > > 2. Making the public cgroup ID APIs (mem_cgroup_id/mem_cgroup_get_from_id) > unconditionally available > > 3. Converting DAMON, LRU gen, and shrinker debugfs interfaces to use > the public cgroup IDs instead of the private IDs > > 4. Removing the now-unused wrapper functions and renaming the public > APIs for clarity > > After this series: > - mem_cgroup_private_id() / mem_cgroup_from_private_id() are used for > internal kernel objects that outlive their cgroup (swap, workingset) > - mem_cgroup_id() / mem_cgroup_get_from_id() return the public cgroup ID > (from cgroup_id()) for use in userspace-facing interfaces > > Note: please apply this series after the patch at > https://lore.kernel.org/20251225002904.139543-1-shakeel.butt@linux.dev/ Makes sense to me. Originally I was not supper happy about the private interface as this should be really private to memcg proper but then I have noticed the lru code needs this outside and dealing with that would be quite messy so an explicit name is probably better in the end. Feel free to add Acked-by: Michal Hocko Thanks! > > Shakeel Butt (8): > memcg: introduce private id API for in-kernel users > memcg: expose mem_cgroup_ino() and mem_cgroup_get_from_ino() > unconditionally > memcg: mem_cgroup_get_from_ino() returns NULL on error > memcg: use cgroup_id() instead of cgroup_ino() for memcg ID > mm/damon: use cgroup ID instead of private memcg ID > mm/vmscan: use cgroup ID instead of private memcg ID in lru_gen > interface > memcg: remove unused mem_cgroup_id() and mem_cgroup_from_id() > memcg: rename mem_cgroup_ino() to mem_cgroup_id() > > include/linux/damon.h | 4 +-- > include/linux/memcontrol.h | 26 +++++++---------- > mm/damon/core.c | 7 ++--- > mm/damon/sysfs-schemes.c | 6 ++-- > mm/list_lru.c | 2 +- > mm/memcontrol-v1.c | 6 ++-- > mm/memcontrol-v1.h | 4 +-- > mm/memcontrol.c | 60 ++++++++++++++++++-------------------- > mm/shrinker_debug.c | 13 +++++---- > mm/vmscan.c | 17 ++++------- > mm/workingset.c | 8 ++--- > 11 files changed, 68 insertions(+), 85 deletions(-) > > -- > 2.47.3 -- Michal Hocko SUSE Labs