From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m35-116.mailgun.net (m35-116.mailgun.net [69.72.35.116]) (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 48E4A18E740 for ; Mon, 29 Jul 2024 21:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=69.72.35.116 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722288186; cv=none; b=NKiOekobPSfCQFg2zvKzUDb3JBrpxMuStSuJYhDAxfWk4T54uyk6y+cBFG5TeGYEJrRlLkB2OJU/pTXhFoFeSE5QN35aZfJ/YyIcwBCo5ZwLFiTkX751wCRnYmTZkph2z+VjLarRIJ7rHwdRPtK0z0B4qHBGx+vCtesdVinHP4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722288186; c=relaxed/simple; bh=54Ak1+K4R79/npDbs4UtUU9rG6vREN5KRCLxgY0YgX0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=nZTgeqoEg7Ki0Za22MTdoq7RB1mBbq73IbspMYN5RQ2qDok+Iq3qw6Z0TrVzD3T8hpvpoeY3qw+6XAbkib7ilN5a9Yog1B38+vLnozgB3qRllB5WW3O8whGY+8UteS8YiYI2QdqOB4+XEktWnq6LTXISbWPrBGIrYSTmoEX2Q10= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vimeo.com; spf=pass smtp.mailfrom=relay.vimeo.com; dkim=pass (1024-bit key) header.d=relay.vimeo.com header.i=@relay.vimeo.com header.b=ffqgKZRz; arc=none smtp.client-ip=69.72.35.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vimeo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=relay.vimeo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=relay.vimeo.com header.i=@relay.vimeo.com header.b="ffqgKZRz" DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=relay.vimeo.com; q=dns/txt; s=mailo; t=1722288182; x=1722295382; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Subject: Cc: To: To: From: From: Sender: Sender; bh=a7Ljw3AXkZDzOFLBKFNTY35O0ifJdJ40YsuUE1AtXfE=; b=ffqgKZRzwWe/rjwPkeU0auwsgZE8n2OXANRPo2taxUJDP0teyQ4lDzl9KAoWMQDz6Vi3AkQYEEsFq7Zi8tFTJ4tx4GDVV7Kc3rRIxBKnd4mM1Wi1rHVoow4GSeaC/aqKf/TWK8teWRy6j+WIyIieLSgxGzM/u9FBtrxxp7rjo6c= X-Mailgun-Sending-Ip: 69.72.35.116 X-Mailgun-Sid: WyIzY2RlYyIsImNncm91cHNAdmdlci5rZXJuZWwub3JnIiwiOWQyYTFjIl0= Received: from smtp.vimeo.com (215.71.185.35.bc.googleusercontent.com [35.185.71.215]) by 1ba2f445e949 with SMTP id 66a80836c423567e51c57d50 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 29 Jul 2024 21:23:02 GMT Sender: davidf=vimeo.com@relay.vimeo.com Received: from nutau (gke-sre-us-east1-main-c45160e0-ow8k.c.vimeo-core.internal [10.56.27.211]) by smtp.vimeo.com (Postfix) with ESMTP id 120CA64FC7; Mon, 29 Jul 2024 21:23:02 +0000 (UTC) Received: by nutau (Postfix, from userid 1001) id 5BB66B409D2; Mon, 29 Jul 2024 10:38:00 -0400 (EDT) From: David Finkel To: Muchun Song , Tejun Heo , Roman Gushchin , Andrew Morton Cc: core-services@vimeo.com, Jonathan Corbet , Michal Hocko , Shakeel Butt , Shuah Khan , Johannes Weiner , Zefan Li , cgroups@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, =?UTF-8?q?Michal=20Koutn=C3=BD?= Subject: [PATCH v6] mm, memcg: cg2 memory{.swap,}.peak write handlers Date: Mon, 29 Jul 2024 10:37:41 -0400 Message-Id: <20240729143743.34236-1-davidf@vimeo.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This is an updated patchset rebasing onto -torvalds master (post 6.11-rc1), and addressing comments from Michal and Tejun. As requested by Tejun and Johannes, I've removed the explicit check for the string "reset", so it now allows any non-empty string. (Empty strings get filtered before our write handler executes) I've also made several of the field reads and writes atomic with {READ,WRITE}_ONCE, and adjusted more of the types to be unsigned. Documentation/admin-guide/cgroup-v2.rst | 22 ++-- include/linux/cgroup-defs.h | 5 + include/linux/cgroup.h | 3 + include/linux/memcontrol.h | 5 + include/linux/page_counter.h | 11 +- kernel/cgroup/cgroup-internal.h | 2 + kernel/cgroup/cgroup.c | 7 + mm/memcontrol.c | 116 +++++++++++++++-- mm/page_counter.c | 30 +++-- tools/testing/selftests/cgroup/cgroup_util.c | 22 ++++ tools/testing/selftests/cgroup/cgroup_util.h | 2 + tools/testing/selftests/cgroup/test_memcontrol.c | 229 +++++++++++++++++++++++++++++++-- 12 files changed, 419 insertions(+), 35 deletions(-) [1]: https://lore.kernel.org/cgroups/20240724161942.3448841-3-davidf@vimeo.com/T/