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 DC508C433EF for ; Wed, 12 Jan 2022 23:43:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F1E86B0072; Wed, 12 Jan 2022 18:43:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A1C06B0073; Wed, 12 Jan 2022 18:43:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 141DA6B0074; Wed, 12 Jan 2022 18:43:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 041DA6B0072 for ; Wed, 12 Jan 2022 18:43:22 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 8B1E9944E5 for ; Wed, 12 Jan 2022 23:43:21 +0000 (UTC) X-FDA: 79023263802.09.6BCE578 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by imf03.hostedemail.com (Postfix) with ESMTP id E78BB20015 for ; Wed, 12 Jan 2022 23:43:20 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id w7so824462ioj.5 for ; Wed, 12 Jan 2022 15:43:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BaIEd4azRffEg4unDNu3vsM967zzodtSvI+HO9xblew=; b=L8O+0OVX45MTK0bIwZtr0Xzs4Q8XHHPBf0k+YHk1TfBnsWsX6/eh9SUyPwi6iG3kwK 0iRhOsvBovQoAUaLCU6lkfmXa2bQv09r3ziUwv8plzoDrnXAL+LCmK+Gh93Gr9G2f1Xi +fBCf+WKROvUyqQI8zr56hOdcK7pYa1MSLCsh/dQWKy89Zyu8o3Qts+TYFW47ig/AxXe WcLnJPcdEvPRs10Jz/86rnfHcgUAk3HMOTiiQJ8+3eT6tJ2pE6cMLpDLHzhMB7Irj0V7 Gc5RlGs2TgG2NGpk4Y//DcGwpcbmYiXbiN+ZV4ezeAxjRn9AnHXQ7KikX7PsdSTZqVfL zavw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BaIEd4azRffEg4unDNu3vsM967zzodtSvI+HO9xblew=; b=GnMyFP8+wfXJVr9YGX5zowVtJ5pa2WH3GcvWatX32O22z9f/Rf4BWczZ6aiPpQn+0U Y9LCDfd+tAQfpgZwY9LSHND/2h3b61aoGTSrFf7ZBUN5thw6b/TZWJ0O2IE0jJsChkgl m3k6eLYzN9Rb+0HXLDfeAzYCay6UfRZEFhTwrPo1GyDgPBws67maNOEd/ola4RoIV9sM fQKRwF8v6t1UgMjlwQaIe7cIVs8PPjzsxfmdxkKgpb/29D/ovXnsBAg0jgomXBNaeo05 AK94tmZRfp1ndbnrs+dZA49CwJ5YjgBIUSevFbXmCrEsB0adPeiBjUcDuUOojpZUHOcg zdhg== X-Gm-Message-State: AOAM531o/UP3aQQaAp4sc8Magpncnodd5uP3xc+WEVE48lPviSrFlJbR CbbRf91Y8C3bK7sB3VN/i+xtqg== X-Google-Smtp-Source: ABdhPJwjyIAd/qG5g5lRDwYWNJCUGBoB3cLknLrXPs+wVsBV2bmPfZwZAO5qzY0E/Fj5GwfSdS77gQ== X-Received: by 2002:a6b:dc0d:: with SMTP id s13mr1002999ioc.186.1642030999695; Wed, 12 Jan 2022 15:43:19 -0800 (PST) Received: from google.com ([2620:15c:183:200:ac2b:c4ef:2b56:374c]) by smtp.gmail.com with ESMTPSA id y8sm914835ilu.72.2022.01.12.15.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 15:43:19 -0800 (PST) Date: Wed, 12 Jan 2022 16:43:15 -0700 From: Yu Zhao To: Michal Hocko Cc: Andrew Morton , Linus Torvalds , Andi Kleen , Catalin Marinas , Dave Hansen , Hillf Danton , Jens Axboe , Jesse Barnes , Johannes Weiner , Jonathan Corbet , Matthew Wilcox , Mel Gorman , Michael Larabel , Rik van Riel , Vlastimil Babka , Will Deacon , Ying Huang , linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, page-reclaim@google.com, x86@kernel.org, Konstantin Kharlamov Subject: Re: [PATCH v6 6/9] mm: multigenerational lru: aging Message-ID: References: <20220104202227.2903605-1-yuzhao@google.com> <20220104202227.2903605-7-yuzhao@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: E78BB20015 X-Stat-Signature: udk7wm8odaximbo43ocsizpbpjoku4h1 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=L8O+0OVX; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf03.hostedemail.com: domain of yuzhao@google.com designates 209.85.166.41 as permitted sender) smtp.mailfrom=yuzhao@google.com X-Rspamd-Server: rspam06 X-HE-Tag: 1642031000-763013 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: On Wed, Jan 12, 2022 at 11:17:53AM +0100, Michal Hocko wrote: > On Tue 11-01-22 18:01:29, Yu Zhao wrote: > > On Mon, Jan 10, 2022 at 05:57:39PM +0100, Michal Hocko wrote: > > > On Tue 04-01-22 13:22:25, Yu Zhao wrote: > > > [...] > > > > +static void walk_mm(struct lruvec *lruvec, struct mm_struct *mm, struct lru_gen_mm_walk *walk) > > > > +{ > > > > + static const struct mm_walk_ops mm_walk_ops = { > > > > + .test_walk = should_skip_vma, > > > > + .p4d_entry = walk_pud_range, > > > > + }; > > > > + > > > > + int err; > > > > +#ifdef CONFIG_MEMCG > > > > + struct mem_cgroup *memcg = lruvec_memcg(lruvec); > > > > +#endif > > > > + > > > > + walk->next_addr = FIRST_USER_ADDRESS; > > > > + > > > > + do { > > > > + unsigned long start = walk->next_addr; > > > > + unsigned long end = mm->highest_vm_end; > > > > + > > > > + err = -EBUSY; > > > > + > > > > + rcu_read_lock(); > > > > +#ifdef CONFIG_MEMCG > > > > + if (memcg && atomic_read(&memcg->moving_account)) > > > > + goto contended; > > > > +#endif > > > > > > Why do you need to check for moving_account? > > > > This check, if succeeds, blocks memcg migration. > > OK, I can see that you rely on the RCU here for the synchronization. A > comment which mentions mem_cgroup_move_charge would be helpful for > clarity. Will do > Is there any reason you are not using folio_memcg_lock in the > pte walk instead? We have a particular lruvec (the first arg), hence a particular memcg to lock. But we don't have a particular page to lock.