Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4339657pxk; Tue, 8 Sep 2020 18:03:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8IjXGRuJyDxYMZQuA1yX4UnB2Jtf7q90riz9ddyHRJc8rVv29T0H1ri3FgtVExw/hE8OK X-Received: by 2002:aa7:cd5a:: with SMTP id v26mr1668008edw.38.1599613379894; Tue, 08 Sep 2020 18:02:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599613379; cv=none; d=google.com; s=arc-20160816; b=T4dJqLPbMWXUKmbXn6Nq5pCx00tMQfO+NeurpXhDo8ll/C/BuEZ34hzdBB2PoKkh00 L8Qa9Ju0aUjydO3Kd1cZ4inqlPeysSWWYH6wJK5M8Rpxn9Gc5Rqusw36W1QAlpzUVRxx v+CXgu4DAj+MogvZqnFrt2xBi8KyGux5W9/y7a0ahSePltU1/NKdkRr+daUdPH4waEka KDaHp9sGxYidNmKnFjzBqc9ugT8sTf07Qsq+AsTy532qVjHNG5bKvy9fN1u4eze3ftj/ 98NRgDhnEcSK8pbkttjgdYeLn0ljVKzO19CLTiiugtqpolaPpr+zImXa31hZr57oS02o DTlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=fVCZ2gAQlCOU+3FQ8zVoZg2a2/Nz/JlYFnCb9jL8Xz0=; b=glmiBoKZO85sLur0qfpOcT10tdoIUzoQVl+bbeEbV7G9In53yDoaEhdxgbIg4oewZF GaN/8HHg4sFPMRsJ25/C4VF6UBoiOdNJwYkjpn3xNCLO+hcedvrGM+PJhBNZ3dwCewcR tHMbitc3kk2f60aPCoZCxJPuIIOiz9PI8imQ3oJ4clU3n8k+mloI+EC012kczo2cKabm KC2oVmXcp8S3FSDjYU1SLGEwTvn+coMGVQyXRKxNIarGo78WupYWgWoghG02ol8xm8lF zC5yuNeIB3dn92RFASZaMX+Jwc570Fek3/xfEI0mYyN7l2Q20l0qxaoYW6O62+TYtREk XhaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=SNQjPYWH; 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 l14si433803ejz.622.2020.09.08.18.02.34; Tue, 08 Sep 2020 18:02:59 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=SNQjPYWH; 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 S1728405AbgIIBBm (ORCPT + 99 others); Tue, 8 Sep 2020 21:01:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbgIIBBm (ORCPT ); Tue, 8 Sep 2020 21:01:42 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F476C061573; Tue, 8 Sep 2020 18:01:41 -0700 (PDT) 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=fVCZ2gAQlCOU+3FQ8zVoZg2a2/Nz/JlYFnCb9jL8Xz0=; b=SNQjPYWHMmaFL7LKw4GX4WfZlG jqCZi08dIMAMm78xsBxjzttVxrreGfM/VkZblsnmw7u/IjfZA+8cVbKcrhuXgKI68/lQkiNTvpJaA u1d9lIuxE++qMUdBjM8NP9Nl1GoK2hBFIkf0ewekXxEkrV+ppWkaOTpuGF6WRGAQxKWB6whYUtJpo aT0MUfU+Bo51JVvUpzB7d6JWHzb0XJcx7osuTkygosX4d9xlTPLYgjwCgGJzFdjocTow9gyLfIPAB PO3jgrUt0dAMTn/b7ZVGH2K+aFTTflDztYCCY98ocrpLwT6fUGwc1K6lN2N7IPFzDI4Azpo4w8Ylu H/nmn/kA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFoUA-0006Dw-54; Wed, 09 Sep 2020 01:01:18 +0000 Date: Wed, 9 Sep 2020 02:01:18 +0100 From: Matthew Wilcox To: Alex Shi Cc: akpm@linux-foundation.org, mgorman@techsingularity.net, tj@kernel.org, hughd@google.com, khlebnikov@yandex-team.ru, daniel.m.jordan@oracle.com, 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, Alexander Duyck Subject: Re: [PATCH v18 31/32] mm: Add explicit page decrement in exception path for isolate_lru_pages Message-ID: <20200909010118.GB6583@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1598273705-69124-32-git-send-email-alex.shi@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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);