Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp268503pxb; Thu, 12 Nov 2020 03:26:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzylk+5XMp7Cbr3r01S7nIVMJxBY4/7xbX64tYBPwdyVSamXFz/k6LzNRZiaLiHoJp5B+nj X-Received: by 2002:a17:906:e4f:: with SMTP id q15mr21201622eji.220.1605180394890; Thu, 12 Nov 2020 03:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605180394; cv=none; d=google.com; s=arc-20160816; b=L5lJ9lTbySgB8PLcuWrKEWztx0bJYYjGFONCR7/ir0deTJS5OWNsgEyfL6ex4ksaKW L1okBqx5HDrIwWah2HPFe2gXDm7OG+XHE+33+7zOP7dGctOYcgSj00YvgoKJAf2Ei6Qo txt/tiJ+vS1G3PWmQZc+TBkky8p6+lcdiHuA9GjYpXJZy0dfoWxsmkJtdfOb917M9h5P q55GkAdswvR3y8E3Lsq7gXU9T1ZsEK6QxS3XL6O+lbinQmTSjnABXWQisXZ8zvqct+WY AkvzGkgft5QUf7o/IJJGzKVsw8KDErucFi/E7ylhlV7eSBMDfeYQOsz70CZ1Kcxip1lG 9RAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=aJ5/+qgN20JoNHJkEuymy/iDJxPEyMT4H3brNIqS0wU=; b=ubRTsX3KM0J5znaYSJUjREIGK76zv59g/aGSh6qwTcMFjtxmzl52XKZb9QDQFeEPnS UshSGDaNwcm5ATArJdiUecth9Kbmdg/BQlUwmRhOaHqJp50zqgywVmyp0tm/17GWECAP lFaRFpiej4r7fi+ldymygHVo3r1x4Gxz/y6Zr901xpH/5kz4Bll1aHTk1GVPWqPHyT3t i59IPtiUBYKyggOohx2hU/B06zZpdNbvk6yilJadQhhfgpriz1NE0S07LED7bEVFZLu2 EwVvUrZHR5U0dHYzr/dUFhTxtB+QWuF4Tpdm9LLvfTig4he1nsqugCr05JOO58f1zEhD xTTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l91si3673735edl.566.2020.11.12.03.26.11; Thu, 12 Nov 2020 03:26:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728003AbgKLLYV (ORCPT + 99 others); Thu, 12 Nov 2020 06:24:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:56218 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725966AbgKLLYU (ORCPT ); Thu, 12 Nov 2020 06:24:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5D0F0AF0D; Thu, 12 Nov 2020 11:24:18 +0000 (UTC) Subject: Re: [PATCH v21 14/19] mm/lru: introduce TestClearPageLRU To: Hugh Dickins Cc: Alex Shi , akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, willy@infradead.org, hannes@cmpxchg.org, lkp@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, shakeelb@google.com, iamjoonsoo.kim@lge.com, richard.weiyang@gmail.com, kirill@shutemov.name, alexander.duyck@gmail.com, rong.a.chen@intel.com, mhocko@suse.com, vdavydov.dev@gmail.com, shy828301@gmail.com, Michal Hocko References: <1604566549-62481-1-git-send-email-alex.shi@linux.alibaba.com> <1604566549-62481-15-git-send-email-alex.shi@linux.alibaba.com> From: Vlastimil Babka Message-ID: <057bb8c8-3993-5638-42e9-f58d72f21b9e@suse.cz> Date: Thu, 12 Nov 2020 12:24:17 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/12/20 3:03 AM, Hugh Dickins wrote: > On Wed, 11 Nov 2020, Vlastimil Babka wrote: >> On 11/5/20 9:55 AM, Alex Shi wrote: >> >> > --- a/mm/vmscan.c >> > +++ b/mm/vmscan.c >> > @@ -1542,7 +1542,7 @@ unsigned int reclaim_clean_pages_from_list(struct >> > zone *zone, >> > */ >> > int __isolate_lru_page(struct page *page, isolate_mode_t mode) >> > { >> > - int ret = -EINVAL; >> > + int ret = -EBUSY; >> > /* Only take pages on the LRU. */ >> > if (!PageLRU(page)) >> > @@ -1552,8 +1552,6 @@ int __isolate_lru_page(struct page *page, >> > isolate_mode_t mode) >> > if (PageUnevictable(page) && !(mode & ISOLATE_UNEVICTABLE)) >> > return ret; >> > - ret = -EBUSY; >> >> I'm not sure why this change is here, looks unrelated to the patch? >> >> Oh I see, you want to prevent the BUG() in isolate_lru_pages(). > > Yes, I suggested this part of the patch to Alex, when I hit that BUG(). > >> >> But due to that, the PageUnevictable check was also affected unintentionally. >> But I don't think it's that important to BUG() when we run into >> PageUnevictable unexpectedly, so that's probably ok. > > Not unintentional. __isolate_lru_page(), or __isolate_lru_page_prepare(), > is a silly function, used by two callers whose requirements are almost > entirely disjoint. The ISOLATE_UNEVICTABLE case is only for compaction.c, > which takes no interest in -EINVAL versus -EBUSY, and has no such BUG(). > > I think it dates back to lumpy reclaim days, and it probably made more > sense back then. Ah, thanks for explaining. >> >> But with that, we can just make __isolate_lru_page() a bool function and >> remove the ugly switch in isolate_lru_pages()? > > I agree that the switch statement in isolate_lru_pages() seems pointless > now, and can be turned into an if{}else{}. But that cleanup is a > diversion from this particular TestClearPageLRU patch, and I think from > the whole series (checking final state of the patchset, yes, the switch > is still there - though I think there have been variant series which > removed it). > > Can we please leave that cleanup until after the series has gone in? Sure thing! The patch seems functionally fine, so Acked-by: Vlastimil Babka > I think several of us have cleanups or optimization that we want to > follow (I had one that inlines what isolate_migratepages_block() wanted > of __isolate_lru_page() into that function, so simplifying what vmscan.c > needs; perhaps that can now eliminate it completely, I've not tried > recently). But there was a point at which the series was growing > ten patches per release as we all added our bits and pieces on top, > it got harder and harder to review the whole, and further from > getting the basics in: I do push back against that tendency. > > Hugh >