From mboxrd@z Thu Jan 1 00:00:00 1970 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 52B97C54734 for ; Tue, 27 Aug 2024 18:36:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6E306B0089; Tue, 27 Aug 2024 14:36:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1E966B008A; Tue, 27 Aug 2024 14:36:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E5666B008C; Tue, 27 Aug 2024 14:36:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 80E926B0089 for ; Tue, 27 Aug 2024 14:36:06 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 27FD5A0731 for ; Tue, 27 Aug 2024 18:36:06 +0000 (UTC) X-FDA: 82498879932.16.0F4F391 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) by imf03.hostedemail.com (Postfix) with ESMTP id CB63A20021 for ; Tue, 27 Aug 2024 18:36:02 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="abkFU1/n"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf03.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.173 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724783667; 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:in-reply-to:references:references:dkim-signature; bh=fC4COB9a49jQDo51O8EEjo2Un9ILN7IVe+fJIOnZ64E=; b=U6KgP4fgP0Bth+ipe0M97t8vvBG+ApEBFNJvOu6BepPTuqISBc5DUZ1Hng0H7oMCYZpIwq ATu4UX9C1XTmib2sXkAg6vl2QD+chWhzgGlVmoA3NfxQY3nbZCkTDPhMsoSegg0eqBE49/ 6VBdj0peGvg5nE7Zgx1/E/hm9CkTgE0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724783667; a=rsa-sha256; cv=none; b=If059sZFUNjWsA5vQH788XkkMEAU+4axzsTg+tj5C/ip8c5Bn/QqEpQrzXjnnALGG+Ckmq 3MRkRJE1PrWcw6gPoYBDwNvFaYPbr8/cJqa92lJ/XpWMRoj7ZqnSbUewVxB8RN9ijC26Sq 5Hq467Jjl0IQypte3khyW209710/B/U= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="abkFU1/n"; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf03.hostedemail.com: domain of shakeel.butt@linux.dev designates 95.215.58.173 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev Date: Tue, 27 Aug 2024 11:35:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1724783760; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fC4COB9a49jQDo51O8EEjo2Un9ILN7IVe+fJIOnZ64E=; b=abkFU1/nEEkmETtUsSeg2a/tzuSakY8Wwbn8J5Qc1ZeQS4r4JuMXE53kuXFShjUMyUQxid NxPA6xZ6J4YGh2a3SJHMKP7UteT/8zLEdCBf+w4I+bW5ilhQ0J2kj4r+XzdorjeRWYQ5qT RO/v2WZS8XzaPcc6/egj1WTlYBxRV3Y= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Kairui Song Cc: linux-mm@kvack.org, Andrew Morton , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Waiman Long , Shakeel Butt , Nhat Pham , Michal Hocko , Chengming Zhou , Qi Zheng , Muchun Song , Chris Li , Yosry Ahmed , "Huang, Ying" Subject: Re: [PATCH 0/7] Split list_lru lock into per-cgroup scope Message-ID: <6tcv72vxurjco5q6mh54lso3lonqxgcb756s7ldwcwur2oul6g@gpfhfevav2oj> References: <20240624175313.47329-1-ryncsn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240624175313.47329-1-ryncsn@gmail.com> X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: CB63A20021 X-Stat-Signature: rk61nkpygucbysqpj7orj3wmrpe9o8jg X-Rspam-User: X-HE-Tag: 1724783762-287297 X-HE-Meta: U2FsdGVkX18bE0JFUAAOIT4JsUT2T/DKnPW2ra8oyJSOzb4q4ObXvS3jda5B8f5Bzi+1SL++qOIipwhD1Eu4SI/kwv/oglAeQvNE3Fe8FJMJLssBFIoU4uHOiCgBgdQ239X121P+Sm6w7tWKtovqGkbcE4XOMx6mi3bJqd7s/45A86Rx7XWdvjPq2aWW49oq8ehXgRfJEwWeqd0At2WXxt2to7XWGptvLqJDmaSVSkGqUWuoB05wlaXLbQAgU2jh9zKDGSycFT7YXbFjY+/3YWyFKKIoYnvCxdOjyGa+MKwFNmgV43dsCLQiNUAq1/hP88+4iF93/XUNOM7QtGxNa9JGIDS4ZXBWw9HN93drNPU0/CsvpjJ3MHseBY1t/Xyk5GpPW0uzjRsWfTYA3msKbjjupL8I1RjJ1w5Krr2ivOTSd6uWHhYpG6N+/dF1JxMcC4Ed3/ApGNtfr7DHg8KGA0aDqKgOb322BpedWISg6HaAfxuTaXIvr0lmmbazvXzpOJyAh1IhUZ+9iurF3cexZYOQ4Uwf4o8BRA5iK5tpQBglUPU7pAkpOzN9ucWUbToCkmzwOrd7+GCNTOii73KUD8CjV8is91CFXXtC4v1wNmUe+PmcCWCBrcOyuhXZIauyLZ/tn22Taz+lCp7jDcrwaDWO4wsd1p7h6dSRdolmQxF3AKzWkBEvOLHKM3pYUm9j/ySDF+zu+SWumYMHDzzwE55ai9BctyYSveaUFwv4FVcBycLp1tcH0phQGLdVCC6TY5SuVetmwvSi7CfFRfSUlV60QhA8iiO2oYvl8/fQLUArEwE1kjYONEz4v8EOoEDqZ/7DL7C9tPgN3zyNUwbpZdJUQV4g5GSZ3gVPMf+QpWK/YCkPKV/rtJPxJFksP3k7CPC2b3gBIGtyM1yogNQFReEReNUBex92dLp6v9nO3tYECOZ5Wq4ACZlBDSQJYXAUJlYRGD72KbncFEvMieP E/WUv46m rR1hqbkhVMQsfgFtsgUbbZbofdgG9bdhVWuPGRg4XAvOUntVE6yLizAU50zgKNECdLwsDbk19h1CvSqYPmGzgz+sbjVEaQIxW4020FXnbselMkqnrVYsL0KpOTB5CyZtNCNWBnIHMXXOZGLVqasTZZGG1E2iDjgOLl514TkOinXkaNfFvtaB9wM9j0y8nbJ+MtfEENgCVHM5deKYGkwwmGt7U4CY0J1esYywn 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: On Tue, Jun 25, 2024 at 01:53:06AM GMT, Kairui Song wrote: > From: Kairui Song > > Currently, every list_lru has a per-node lock that protects adding, > deletion, isolation, and reparenting of all list_lru_one instances > belonging to this list_lru on this node. This lock contention is heavy > when multiple cgroups modify the same list_lru. > > This can be alleviated by splitting the lock into per-cgroup scope. > > To achieve this, this series reworks and optimizes the reparenting > process step by step, making it possible to have a stable list_lru_one, > and making it possible to pin the list_lru_one. Then split the lock > into per-cgroup scope. > > The result is reduced LOC and better performance: I see a ~25% > improvement for multi-cgroup SWAP over ZRAM and a ~10% improvement for > multi-cgroup inode / dentry workload, as tested in PATCH 6/7: > > memhog SWAP test (shadow nodes): > Before: > real 0m20.328s user 0m4.315s sys 10m23.639s > real 0m20.440s user 0m4.142s sys 10m34.756s > real 0m20.381s user 0m4.164s sys 10m29.035s > > After: > real 0m15.156s user 0m4.590s sys 7m34.361s > real 0m15.161s user 0m4.776s sys 7m35.086s > real 0m15.429s user 0m4.734s sys 7m42.919s > > File read test (inode / dentry): > Before: > real 0m26.939s user 0m36.322s sys 6m30.248s > real 0m15.111s user 0m33.749s sys 5m4.991s > real 0m16.796s user 0m33.438s sys 5m22.865s > real 0m15.256s user 0m34.060s sys 4m56.870s > real 0m14.826s user 0m33.531s sys 4m55.907s > real 0m15.664s user 0m35.619s sys 6m3.638s > real 0m15.746s user 0m34.066s sys 4m56.519s > > After: > real 0m22.166s user 0m35.155s sys 6m21.045s > real 0m13.753s user 0m34.554s sys 4m40.982s > real 0m13.815s user 0m34.693s sys 4m39.605s > real 0m13.495s user 0m34.372s sys 4m40.776s > real 0m13.895s user 0m34.005s sys 4m39.061s > real 0m13.629s user 0m33.476s sys 4m43.626s > real 0m14.001s user 0m33.463s sys 4m41.261s > > PATCH 1/7: Fixes a long-existing bug, so shadow nodes will be accounted > to the right cgroup and put into the right list_lru. > PATCH 2/7 - 4/7: Clean up > PATCH 6/7: Reworks and optimizes reparenting process, avoids touching > kmemcg_id on reparenting as first step. > PATCH 7/7: Makes it possible to pin the list_lru_one and prevent racing > with reparenting, and splits the lock. > > Kairui Song (7): > mm/swap, workingset: make anon workingset nodes memcg aware > mm/list_lru: don't pass unnecessary key parameters > mm/list_lru: don't export list_lru_add > mm/list_lru: code clean up for reparenting > mm/list_lru: simplify reparenting and initial allocation > mm/list_lru: split the lock to per-cgroup scope > mm/list_lru: Simplify the list_lru walk callback function > > drivers/android/binder_alloc.c | 6 +- > drivers/android/binder_alloc.h | 2 +- > fs/dcache.c | 4 +- > fs/gfs2/quota.c | 2 +- > fs/inode.c | 5 +- > fs/nfs/nfs42xattr.c | 4 +- > fs/nfsd/filecache.c | 5 +- > fs/xfs/xfs_buf.c | 2 - > fs/xfs/xfs_qm.c | 6 +- > include/linux/list_lru.h | 26 ++- > mm/list_lru.c | 387 +++++++++++++++++---------------- > mm/memcontrol.c | 10 +- > mm/swap_state.c | 3 +- > mm/workingset.c | 20 +- > mm/zswap.c | 12 +- > 15 files changed, 246 insertions(+), 248 deletions(-) > > -- > 2.45.2 > > Hi Kairui, can you send the v2 of this series (without the first patch)? thanks, Shakeel