From patchwork Tue Dec 24 01:13:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JP Kobryn X-Patchwork-Id: 13919567 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 C635FE7718B for ; Tue, 24 Dec 2024 01:14:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 051396B007B; Mon, 23 Dec 2024 20:14:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0015E6B0082; Mon, 23 Dec 2024 20:14:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E0B856B0083; Mon, 23 Dec 2024 20:14:16 -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 C6ED46B007B for ; Mon, 23 Dec 2024 20:14:16 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 74ED4A19EF for ; Tue, 24 Dec 2024 01:14:16 +0000 (UTC) X-FDA: 82928080200.25.50D6EBF Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by imf27.hostedemail.com (Postfix) with ESMTP id 8A57740019 for ; Tue, 24 Dec 2024 01:13:32 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lRouIQcf; spf=pass (imf27.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735002814; 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=EMZgjPOKDWbIFdVRAa452Jjp52BzjoU4BJ4SQLn/om4=; b=7qKajgV6cd4f4jrZV4mF6zdAcyKojja3I1BYWgg/CbSqkWc9jZVt0O9VOTlaR7uJBm8bQ+ aoZX1YOMnaAqI5A+aJKcWIfg7NdPcik16SZNqRocmDXC+c8lkV1WQu0C0KVaiEhnRYiGYP oDaYZhvKIVUXqCu7y07+rNmBKasVQZM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=lRouIQcf; spf=pass (imf27.hostedemail.com: domain of inwardvessel@gmail.com designates 209.85.214.171 as permitted sender) smtp.mailfrom=inwardvessel@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735002814; a=rsa-sha256; cv=none; b=xImuFH4X7GWuxT667x5TmtkQ+FDPupaU54bQRcGbwEUJ30xiUx7hvLlQS+BjHfokyGQe+i sUFyJCTuPitYOeRz6F5MMHG5Qmk0LRZVjbPK4jR/DMR0lLyJ0IHHKQY7ow/CaTwHPMxA97 a2LTXn3sRIPdDHHvamMHPdfMrak7pBE= Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2163dc5155fso43985745ad.0 for ; Mon, 23 Dec 2024 17:14:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735002853; x=1735607653; 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=EMZgjPOKDWbIFdVRAa452Jjp52BzjoU4BJ4SQLn/om4=; b=lRouIQcfb3LS092hh+G0ZtV4s6CroxwBLsWdoW1GXP1LQ9gmzAcOvTQtQHqNsu3+d9 5s/kBcMgGF6fPAosVnd0SgL2mx4R3gCVmESFpD0ZPQTlGoliZvWD71Ig/NJL23qvTOby v9pir+/navdnq9S8ASLNiEa89gcsMAzNwlsONyAKYpAbtBPVBKbPMzSbeu/6O9IYNkm5 uxU6H8mOxHG4KEqEdU8/WUeDN2z6+Lp1hT61mqcQXQQHpheflawnskf6Dq5peAa8sIZI PTFE8NVTsDnMbQD9csYIkiF8pFgafz3E90T9YmIhZ0ckZ+ee1BxXer/yU1QMfVEQ2pkF Fhzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735002853; x=1735607653; 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=EMZgjPOKDWbIFdVRAa452Jjp52BzjoU4BJ4SQLn/om4=; b=ekRqk7d1PMBllmrvB2643jXqjHclTxaFZiaH6orVEjpMZsYbYR43G/RNHcbsD6YStV Fk7tEkCPE/5ZNFDbxJUNR3QKE9YT1RHCpmNriiz7neWlmWJEk2xRSCZEjwCUTAzxNIp3 lvTrvv4Hn9Jody3CYbcIx+SVPghyEXAsfkVYHotPF5vHJlFMwdoiviSQvsH4WhZ1J8fy bVHLopCygEk0GivxBEBloH4aiYx4foR1KaHywJ87dqCAq8i9KO6S2nOEOMtApEpOfJR0 VYiGrNaSTftKGeCHPW7eFHtQdJ3yDO6CLrJcMSN1Vq83RXNpHKQWKww156HWJQfvsaCq VMlQ== X-Gm-Message-State: AOJu0Yy5LeB06Bc5yNEPnvqPyj/ztiQWhSW1D8WNIvGllyjR9r0/J74B YkNa78wwwTXivv8tBXhlvoV+wmj1MxqxvADHecLawX48sDtsOsQd X-Gm-Gg: ASbGncsruIjztFLn+EzSq4gH19OgKKk5kMmZtCTcKsyRtLiR/daLORjtZifgDn97lkR sNFIU4eNM5em3a9k7H2vsS+aOHJbzjkkYCRbyPIq6jrk9zFtqgzOqVBEyUDRmGnNQkd5NXrTHcU PzdDuK7JeMkN+5F6dinM8QFnoyt88eqmU6SBJY3aTHNa6sX6Xe9qp+vl7W4c6SXG6S7S9WPyDzP 90niW47gnDbyK7DGJVtHI7H23mZG/unlYpBuU4K1cOlEpw4Q8SLwI1lig8JR//5EMBe7oMBqFlm W1H42C/OlU9MBLgnAA== X-Google-Smtp-Source: AGHT+IGtHv4OrGiGjKLT1wx4ZC9Ze9zsXK63XwMVjaldX2r8rMkvgsNt28FtHFcLAimEPnWDhWEEIg== X-Received: by 2002:a17:903:2449:b0:216:50fb:5dfc with SMTP id d9443c01a7336-219e6e8c3admr222954205ad.9.1735002853261; Mon, 23 Dec 2024 17:14:13 -0800 (PST) Received: from saturn.. (c-67-188-127-15.hsd1.ca.comcast.net. [67.188.127.15]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc970c84sm79541255ad.58.2024.12.23.17.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Dec 2024 17:14:12 -0800 (PST) From: JP Kobryn To: shakeel.butt@linux.dev, hannes@cmpxchg.org, yosryahmed@google.com, akpm@linux-foundation.org Cc: linux-mm@kvack.org, cgroups@vger.kernel.org Subject: [PATCH 0/9 RFC] cgroup: separate rstat trees Date: Mon, 23 Dec 2024 17:13:53 -0800 Message-ID: <20241224011402.134009-1-inwardvessel@gmail.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8A57740019 X-Rspam-User: X-Stat-Signature: dhbsf1hwi3srkjrqsr6ybk5t5mhqy96q X-HE-Tag: 1735002812-125801 X-HE-Meta: U2FsdGVkX1/CNVaAxPAEtG4YQkuM1Xa2vX45RkazxiXMn8pUQsDadtzQ4CMOfu3pQVOUwmVGHqPgq1z/7N3YUuluMRrINxisFOoY5lTwyC0ncWw/2A+S5JZQY+jeomNldYU/hK7ekYV0wHHL2KSkzaBZ69OsncDKpFdWneiuPnmncAU174Sd3ThZSJPq6qN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adDgI3DMrTlARt+6cqTNzSjXm/wb+E5AeF2INkQIfwMkUWERft/nKqHXQVXIucc1dHNwidlOEG0dP6q X-Bogosity: Ham, tests=bogofilter, spamicity=0.066749, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: I've been experimenting with these changes to allow for separate updating/flushing of cgroup stats per-subsystem. The idea was instead of having a single per-cpu rstat tree for managing stats across all subsystems, we could maybe split up the rstat trees into separate trees for each subsystem. So each cpu would have individual trees for each subsystem. It would allow subsystems to update and flush their stats without having any contention with others, i.e. the io subsystem would not have to wait for an in progress memory subsystem flush to finish. The core change is moving the rstat entities off of the cgroup struct and onto the cgroup_subsystem_state struct. Every patch revolves around that concept. I reached a point where this started to feel stable in my local testing, so I wanted to share and get feedback on this approach. JP Kobryn (8): change cgroup to css in rstat updated and flush api change cgroup to css in rstat internal flush and lock funcs change cgroup to css in rstat init and exit api split rstat from cgroup into separate css separate locking between base css and others isolate base stat flush remove unneeded rcu list remove bpf rstat flush from css generic flush block/blk-cgroup.c | 4 +- include/linux/cgroup-defs.h | 35 ++--- include/linux/cgroup.h | 8 +- kernel/cgroup/cgroup-internal.h | 4 +- kernel/cgroup/cgroup.c | 79 ++++++----- kernel/cgroup/rstat.c | 225 +++++++++++++++++++------------- mm/memcontrol.c | 4 +- 7 files changed, 203 insertions(+), 156 deletions(-)