From patchwork Wed Jul 24 19:02:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinsey Ho X-Patchwork-Id: 13741271 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 6F78FC3DA63 for ; Wed, 24 Jul 2024 19:02:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 631166B007B; Wed, 24 Jul 2024 15:02:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E1266B0082; Wed, 24 Jul 2024 15:02:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A8D56B0083; Wed, 24 Jul 2024 15:02:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2C0546B007B for ; Wed, 24 Jul 2024 15:02:21 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id AF343160B2F for ; Wed, 24 Jul 2024 19:02:20 +0000 (UTC) X-FDA: 82375566840.12.866AF44 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf21.hostedemail.com (Postfix) with ESMTP id 01A111C0032 for ; Wed, 24 Jul 2024 19:02:18 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=JE71DpFL; spf=pass (imf21.hostedemail.com: domain of 3uU-hZggKCBoA8DI4O7E6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--kinseyho.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3uU-hZggKCBoA8DI4O7E6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--kinseyho.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721847714; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=/xqHzlmnvmA4mc0gG2MKsc72BaoN9Cca8ZYVFJCm0vo=; b=f4lSM996whcTJwE2uCJBGBaNCrmPtX+s9n3kYNKvnCyeogB3FfrsH6RC92V+Os5yGn+Kto R8bWwXGqcgUVWm1tgvQqEDcHkQIM92CR+hn1qCBOx4TzSzCFrNCr5907FeNJOiqM3iz6Wh +AwTo38lTo5imy/McnqQFiiS1sugKKU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=JE71DpFL; spf=pass (imf21.hostedemail.com: domain of 3uU-hZggKCBoA8DI4O7E6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--kinseyho.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3uU-hZggKCBoA8DI4O7E6EE6B4.2ECB8DKN-CCAL02A.EH6@flex--kinseyho.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721847714; a=rsa-sha256; cv=none; b=2iA4HShBcqUdznClo111Xm+87lTivCQSTvmdw825jm9JvwOzC8qPKlNEAWjR3gjBWGHAzP KY97Os5jVmVc8Pf1xoeyN+XS15tPsoYOaPq15WczKXJAzx+9n14PQTqJZ3ofR/eJ4N2jim 0j/PzCsDshoIMGyzy22JHN2Ra/vX2W0= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e02a4de4f4eso86185276.1 for ; Wed, 24 Jul 2024 12:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1721847738; x=1722452538; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=/xqHzlmnvmA4mc0gG2MKsc72BaoN9Cca8ZYVFJCm0vo=; b=JE71DpFLTSSSUrV2tOFDlLNKLTyDyCBL8zdGDN1PzcRTjby27oRtOXqvmSl9pFceuz SfDdAlgPw4HHr2lU/9+e1vq0+rkHHpj5lp31C4GtRUExJj0tcLrWXpp4QarkOUtnhOWu 5KkFc/nQR+WUwoXTaPhXoMPf+8LV/nApC6c0iBT5gXaqlTUggffukSenCbiFyJn5RxNN 2Rn44525usp7Xbs1XJwLUbGTNuKs7Amg2uFP5ChU4T8DoGB/78QwVC+HG9UvvCKi9mdZ duFXF8at2p/yuZHZyDeVVABBycfUaHhTkY7+w2lVr72CKLwaUQi8nQxfpQbynV7FYxk9 xO1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721847738; x=1722452538; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/xqHzlmnvmA4mc0gG2MKsc72BaoN9Cca8ZYVFJCm0vo=; b=QoJ85jlemt0lTKbBtjfNbrH/FFVkYBhUVv806H90JO58K/z139+nN0EaHF6on63NX+ iVlVSL2EfeOuw6kX6yu7mr2v6rtYn5EcRO5chnSvUWlt4pL/nd1s5aKNTQHG+xJpDAMw 4FBsmTK+YLSMNrPiJrAhLv1gGsY2f1YUWvZmQrevXLZdgEnd6l5dexmXfHHM6WVov8wn gbQYkAyjV+H6ARVisR6k0g0yewS6Imj3leXoOY8pr4tYcftMM9DvFf/IGrU0DkIS+c/9 hRpNOFPnIhv6xCm1rcDCseGpdFUWfYZmbdJtlkzYbB4UDe147yxmhfkckBBheZZrghD8 IvaA== X-Gm-Message-State: AOJu0YzLFI6CuENYlS3j6J7rdhNZvzOf/Dv4AuuUK8voNKiGKPwiJNq7 Cv9lg0P3jLHj5QWUnF9VbKt6sFA0lZv2qQn2mCMP5/9Mgl5YgJv9zVydAIzxSVlQmgO1YbYx9h+ +81V1Zw+0fw== X-Google-Smtp-Source: AGHT+IHJfVbEtJxO61V9UPy4Vh/DvuL9qPuKIxDxcfTs5/S4QgOxgAUtmQ0vwobOLJaiV/CINzjdTA7g1RXpuQ== X-Received: from kinseyct.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:46b]) (user=kinseyho job=sendgmr) by 2002:a05:6902:1245:b0:e02:5b08:d3a with SMTP id 3f1490d57ef6-e0b22f0c922mr774276.0.1721847737866; Wed, 24 Jul 2024 12:02:17 -0700 (PDT) Date: Wed, 24 Jul 2024 19:02:10 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog Message-ID: <20240724190214.1108049-1-kinseyho@google.com> Subject: [PATCH mm-unstable v1 0/4] Improve mem_cgroup_iter() From: Kinsey Ho To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed , Roman Gushchin , Kinsey Ho X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 01A111C0032 X-Stat-Signature: e95c9j7cs6xw6zf8qioern98rnywqbbx X-Rspam-User: X-HE-Tag: 1721847738-322814 X-HE-Meta: U2FsdGVkX18QjCUxwow9MGO/ldms7fl3w8ijiuMpqplhtr/g447CjVcIxp8jKgREk1o2Jj3FM1lINUDuCc8kC0Gt6vDBgMol2ngpD/hEdRHwGWXlU4CXQLzl2ys1p3yHWuvsMLV8pWFUH9klOSwfdknGRDj8WMEQl0nws3XHP6scpJ2lvGY635ekq0uDufhDywMgkrBxNWnNekj0Ldhk88XvmOZ9TFmfX/QxT3iIKp82EWE+ensQh+I7VRRDM1d0ldtqMbiyAEG6FdrlvcClNKyXAccXs4YzJZgVh6zfJoHv9QYpsenfhqMUcPHGZcRZkRXufzIcoRA+2+9DqABWGvttG9UqsfOj8sSJY0yTs7pAnOpXihCFvQDpajr9KjC+Wb0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CSbLWGlx6mWxOdvNdxHa3CLpkFqOIHO/VtaQ4JJNrpwSV0uoEWTglPePFk0YTq4w1Jl/vtUFjNWKXpSVEQx7aLXmWBrCfKmj5lhe+suVg+Syz6KuiltSrQBrrE9FGa6z+fGaqrLIsKIT+R8fiYfMYuLvyK8OwK10JVSzg6JVPignh2otl51gqK7IB3GFFIF9qb0uQKd1Qox2ZKU8nT8kZP3xoixf2holgVrBxu/19J5U1OL17kzsnl25YYrY6lJynlYmI1FDAPKCc9a0DDQgk3sVGa9l9/HKL1Ex2bD0kk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000228, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Incremental cgroup iteration is being used again [1], but incremental cgroup iteration was introduced for cgroup v1. It hasn't been fully maintained for many years. This patchset improves the reliability of mem_cgroup_iter(), along with improving simplicity and code readability. [1] https://lore.kernel.org/20240514202641.2821494-1-hannes@cmpxchg.org/ Kinsey Ho (4): mm: don't hold css->refcnt during traversal mm: increment gen # before restarting traversal mm: restart if multiple traversals raced mm: clean up mem_cgroup_iter() include/linux/memcontrol.h | 6 +-- mm/memcontrol.c | 84 +++++++++++++++----------------------- 2 files changed, 37 insertions(+), 53 deletions(-) Acked-by: Roman Gushchin