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 A5F2BC433F5 for ; Sun, 23 Jan 2022 21:40:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 104046B0081; Sun, 23 Jan 2022 16:40:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B3596B0083; Sun, 23 Jan 2022 16:40:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE3AA6B0085; Sun, 23 Jan 2022 16:40:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0160.hostedemail.com [216.40.44.160]) by kanga.kvack.org (Postfix) with ESMTP id DFC5E6B0081 for ; Sun, 23 Jan 2022 16:40:42 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 84F278249980 for ; Sun, 23 Jan 2022 21:40:42 +0000 (UTC) X-FDA: 79062871524.10.F93E621 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by imf05.hostedemail.com (Postfix) with ESMTP id 24A92100003 for ; Sun, 23 Jan 2022 21:40:42 +0000 (UTC) Received: by mail-io1-f50.google.com with SMTP id 9so1640523iou.2 for ; Sun, 23 Jan 2022 13:40:41 -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=IyKNPXR0xXBAL80gtxnxeT19PyLCAGmnDeiaMG7++bM=; b=ZMlU5JvaMGRzZqWwhMytbclyq2hK+DR3jCfjxiTok0CS8FFyYCsm/UFaEtOyfdSk5d kdtDiVMulhEgRlVhTMXABPMK7hLpwFGzeajhi/W9rVzcnuu9ME4FK9ShDLgi/D0BXH+O PQiTqpuxJngULJ6oaET3u7sRaihthGRaApk0q5G5fZTetiQ/60Kocm74RrILXTUc1tT8 SAaEc8KTvcOMSd3QUG+gAnOEsETBwbGBmdvn/pETf8PFCVxiQtnjoA9jMVbQeparWeJ+ sRpsptQQ0obvOnaqu5N0/rjQ/Zg1xGqcTus8V6e1Ykc2aqAFUi9zfKZ/IYjWxqn2tSr2 ifSQ== 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=IyKNPXR0xXBAL80gtxnxeT19PyLCAGmnDeiaMG7++bM=; b=646rDH+qE/PGs8kwyMr632ubQqnTV5n8EO89ir19vwSUjWvFSQy6ISuU39gypVyLLG 9Oajl6znAkQ6hcokrZA69lIjyblnrMH97TEE42V3ckM014L1sKmPzkA/Vid4CRCZZ6R5 SCh+yHI8xKz38dGZ5ILyw5rkyMYwSCzZUwrdFUv4ItzLdhAVctZSJkXdiMx/0byKRHQ0 6UVrQIoAVq0eReOcmTkEzI8gPe3xXX0QK5zFqa/IuwK8LjMKdfTt+Gbeqb3W5+Ibfhml 7Yqt/r/q/iyvbAtmw6kUeFmerGq92pojhI+4cZ4OAR5oOBUV9uFRSB3Gocfu0Wnn8hqB ssMQ== X-Gm-Message-State: AOAM53107TvCu8VJyo8iQRuUS5Ld7rEhbyTFf79KRIoqOa+LQGOqEDUC a3oNS9iqi1SyXb3emrkcCtnfJw== X-Google-Smtp-Source: ABdhPJzxHVZd/U5xuji1+wbXuf3oi0S1JW3F72Mw005SIgUl8rEA/x+DErKmKSlc6HG3ZjPbcd2wog== X-Received: by 2002:a05:6638:ec7:: with SMTP id q7mr5992263jas.210.1642974041316; Sun, 23 Jan 2022 13:40:41 -0800 (PST) Received: from google.com ([2620:15c:183:200:b551:d37:7fd2:5a1a]) by smtp.gmail.com with ESMTPSA id w19sm5474492iov.16.2022.01.23.13.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 13:40:40 -0800 (PST) Date: Sun, 23 Jan 2022 14:40:36 -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-Server: rspam08 X-Rspamd-Queue-Id: 24A92100003 X-Stat-Signature: 7j98u8zrrd6w9z8du98emk6by5o4cecy Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ZMlU5Jva; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of yuzhao@google.com designates 209.85.166.50 as permitted sender) smtp.mailfrom=yuzhao@google.com X-HE-Tag: 1642974042-742057 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 Thu, Jan 13, 2022 at 12:57:35PM +0100, Michal Hocko wrote: > On Wed 12-01-22 16:43:15, Yu Zhao wrote: > > On Wed, Jan 12, 2022 at 11:17:53AM +0100, Michal Hocko wrote: > [...] > > > 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. > > That is certainly true at this layer but the locking should be needed > only for specific pages, no? Yes. > So you can move the lock down to the > callback which examines respective pages. Or is there anything > preventing that? No. > To be honest, and that is the reason I am asking, I really do not like > to open code the migration synchronization outside of the memcg proper. Agreed. > Code paths which need a stable memcg are supposed to be using > folio_memcg_lock for the specific examination time. No argument here, just a clarification: when possible I prefer to lock a batch of pages rather than individual ones. > If you prefer a > trylock approach for this usecase then we can add one. Done. Thanks.