Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1157710pxb; Fri, 21 Jan 2022 11:04:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8lOuBn1M9Zz7ihIzRuSTTQHwHM8d6PTzIjjBZZeMQFxtLgcfE+7Y+B3VbRCFj3PITaFwZ X-Received: by 2002:a63:82c2:: with SMTP id w185mr2504964pgd.16.1642791887336; Fri, 21 Jan 2022 11:04:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642791887; cv=none; d=google.com; s=arc-20160816; b=Ioq8+JmPr41cQ/GqKpxeoviJpgrIlZsh6Y6EqxMTxkMoQvJOFpvk48Lh+U9ftPHz7q PXQtoSJCRsVWZTM4+o36aItZCd3AkCM96bKQGVi0mePZnIb/Eej9MYLqtdRzli6m7zJX IZDNS1gIxk+pZVii2azGM7JNsm5mUTG3vyVzA3Irn8xlS0hguSgzzpUqcrKEdqrDdumf sG4ndjV39p/A4qTu8NX45OloB/2mb2ILrhMQgZaEnwfi+yHnaDBLd6RZxGtIyV7mG6E0 xgo17IdWC8LT/aOjEOWp2E5XsEAw4f6mn3nxJsb/3lMbXCE8mdZFdigVy6m2prtfst/E fl7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=sBwHHJ1ePgsQCKzWB+AeBOf9B49vrtvnggHlWqo57lQ=; b=rhho0C+037153x8WmANoQ4qBLCgW+E+gaDaA1lMcsLXqTXhovxS9U+5ILS6+WaGrqH UXP3at2uD17DS3ds4Wf5jTlVDW/m5qOaIMzCXp1jqBw6dBtPaNNy+jwfFXAWqWhRA8yP rmYokXYnmoXtX9V4ZIJ5itP2Afl8pRe4UWT5SYx3h256r/2acB2NrrPbp0flSMOR6lxb ms8+emc8zW+KqapI0KYCZtPVRCaVH+8B8YVfGJd8Q1Ze0VelhtfAWgOfCCWLX8GKQVf7 HaE3CSAusoXe6K7z7EX5bzjyQADCott0PC6kxw5XzR4owhvjnNNgifkzFFeZlzbqpJjp NTJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=OhjQ5S+3; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si5786250pfm.65.2022.01.21.11.04.30; Fri, 21 Jan 2022 11:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=OhjQ5S+3; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352837AbiASJdP (ORCPT + 99 others); Wed, 19 Jan 2022 04:33:15 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:58136 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234544AbiASJdO (ORCPT ); Wed, 19 Jan 2022 04:33:14 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 126B21F38B; Wed, 19 Jan 2022 09:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1642584793; h=from:from:reply-to: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=sBwHHJ1ePgsQCKzWB+AeBOf9B49vrtvnggHlWqo57lQ=; b=OhjQ5S+3jTKJtj13rH9+qcQS7K/pNbNNrkUDRiTRiKXztA2+TX7pFRQuzZnM5Qo6ll+iJv Fxz10ktEKFl55pu8bOYGyyKDSWT5W4HQikdMgrCfIhGaMnwdqU5JM9Bt6jpCfoB37JNh2x +Yinoc8i+oeJm9NOrEgqEyVgEYGukcM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id BCD4C13E11; Wed, 19 Jan 2022 09:33:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Xr98Ldja52FOKAAAMHmgww (envelope-from ); Wed, 19 Jan 2022 09:33:12 +0000 Date: Wed, 19 Jan 2022 10:33:11 +0100 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Muchun Song Cc: Matthew Wilcox , Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , Shakeel Butt , Roman Gushchin , Yang Shi , Alex Shi , Wei Yang , Dave Chinner , trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, jaegeuk@kernel.org, chao@kernel.org, Kari Argillander , linux-fsdevel , LKML , Linux Memory Management List , linux-nfs@vger.kernel.org, Qi Zheng , Xiongchun duan , Fam Zheng , Muchun Song Subject: Re: [PATCH v5 10/16] mm: list_lru: allocate list_lru_one only when needed Message-ID: <20220119093311.GD15686@blackbody.suse.cz> References: <20211220085649.8196-1-songmuchun@bytedance.com> <20211220085649.8196-11-songmuchun@bytedance.com> <20220106110051.GA470@blackbody.suse.cz> <20220113133213.GA28468@blackbody.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Jan 18, 2022 at 08:05:44PM +0800, Muchun Song wrote: > I have thought about this. It's a little different to rely on objcg > reparenting since the user can get memcg from objcg and > then does not realize the memcg has reparented. When you pointed that out, I'm now also wondering how memcg_list_lru_alloc() would be synchronized against reparenting/renumbering of kmemcg_ids. What I suspect is that newly allocated mlru may be stored into the xarray with a stale kmemcg_id. > Maybe holding css_set_lock can do that. I do not think this > is a good choice. I agree, it doesn't sound well. > Do you have any thoughts about this? Thoughts / questions of what I don't undestand well: - Why do you allocate mlrus for all ancestors in memcg_list_lru_alloc()? - It'd be sufficient to allocate just for the current memcg. - Possibly allocate ancestors upon reparenting (to simplify the allocation from slab_pre_alloc_hook itself). - What is the per-kmemcg_id lookup good for? - I observe most calls of list_lru_from_memcg_idx() come from callers that know memcg (or even objcg). - The non-specific use case seems list_lru_walk_node() working with per-node and not per-memcg projection. - Consequently that is only used over all nodes anyway (list_lru_walk(). - The idea behind this question is -- attach the list_lrus to obj_cgroup (and decomission the kmemcg_id completely). (Not necessarily part of this series but independent approach.) Thanks, Michal