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 X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CD34C10DAA for ; Wed, 9 Sep 2020 17:07:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2FA1721D80 for ; Wed, 9 Sep 2020 17:07:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hfgEADwy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FA1721D80 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7E3FD8E0003; Wed, 9 Sep 2020 13:07:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7958F6B0087; Wed, 9 Sep 2020 13:07:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 682FB8E0003; Wed, 9 Sep 2020 13:07:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 4FA666B0085 for ; Wed, 9 Sep 2020 13:07:50 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 03AC23622 for ; Wed, 9 Sep 2020 17:07:50 +0000 (UTC) X-FDA: 77244155100.22.tent84_2b05a46270df Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id C9A7D18038E68 for ; Wed, 9 Sep 2020 17:07:49 +0000 (UTC) X-HE-Tag: tent84_2b05a46270df X-Filterd-Recvd-Size: 4492 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Sep 2020 17:07:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=6BdBPXJ8XQ6dfeqF8dncKUjTFopmPuRS/B/dl8JZcac=; b=hfgEADwyatdZgRCv4HedPewUgr Z5yHyqRWXGgLxnBngNkckmik9vLonqHLyt6/X2g0X64afWCiiVrXixO7LMWLj5L65iwEQ04DOAIqW W0pR5PZbCGyIMkEO713IdjH8mBkU/FmFPGEWPXSQ4hC6jURyfYG6idODxcWpMgdxyrIgUHxZBlLv9 +8rLnXwL1R7IW/voe+UYGk6bwztj7l+VQpqkLfxrHU10aEcahIA7WaxW486c2weui77TBhr9DECJ7 R9nMf6JsMmQTjIHXKEcHK0QPRg1x8DKJJ+iB4U2GbKJNdRsI07LfPl3hXVGRn45fFkhqn6+2MIZzs Xi+cpe4A==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kG3Yz-0008CM-44; Wed, 09 Sep 2020 17:07:17 +0000 Date: Wed, 9 Sep 2020 18:07:17 +0100 From: Matthew Wilcox To: Alexander Duyck Cc: Alex Shi , Andrew Morton , Mel Gorman , Tejun Heo , Hugh Dickins , Konstantin Khlebnikov , Daniel Jordan , Johannes Weiner , kbuild test robot , linux-mm , LKML , cgroups@vger.kernel.org, Shakeel Butt , Joonsoo Kim , Wei Yang , "Kirill A. Shutemov" , Rong Chen , Michal Hocko , Vladimir Davydov , shy828301@gmail.com, Alexander Duyck Subject: Re: [PATCH v18 31/32] mm: Add explicit page decrement in exception path for isolate_lru_pages Message-ID: <20200909170717.GK6583@casper.infradead.org> References: <1598273705-69124-1-git-send-email-alex.shi@linux.alibaba.com> <1598273705-69124-32-git-send-email-alex.shi@linux.alibaba.com> <20200909010118.GB6583@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: C9A7D18038E68 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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, Sep 09, 2020 at 08:43:38AM -0700, Alexander Duyck wrote: > On Tue, Sep 8, 2020 at 6:01 PM Matthew Wilcox wrote: > > > > On Mon, Aug 24, 2020 at 08:55:04PM +0800, Alex Shi wrote: > > > +++ b/mm/vmscan.c > > > @@ -1688,10 +1688,13 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan, > > > > > > if (!TestClearPageLRU(page)) { > > > /* > > > - * This page may in other isolation path, > > > - * but we still hold lru_lock. > > > + * This page is being isolated in another > > > + * thread, but we still hold lru_lock. The > > > + * other thread must be holding a reference > > > + * to the page so this should never hit a > > > + * reference count of 0. > > > */ > > > - put_page(page); > > > + WARN_ON(put_page_testzero(page)); > > > goto busy; > > > > I read Hugh's review and that led me to take a look at this. We don't > > do it like this. Use the same pattern as elsewhere in mm: > > > > page_ref_sub(page, nr); > > VM_BUG_ON_PAGE(page_count(page) <= 0, page); > > Actually for this case page_ref_dec(page) would make more sense > wouldn't it? Otherwise I agree that would be a better change if that > is the way it has been handled before. I just wasn't familiar with > those other spots. Yes, page_ref_dec() should be fine. It's hard to remember which of VM_BUG_ON, WARN_ON, etc, compile down to nothing with various CONFIG options, and which ones actually evalauate their arguments. Safer not to put things with side-effects inside macros.