Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5386281imu; Wed, 19 Dec 2018 10:11:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/W5npV7m91JNMVTkhaIT3LyvRbdwkM3lTYmJp5PHJugA7qP322ZHvd5Q0FCBbjayf6igKUp X-Received: by 2002:a62:1f9d:: with SMTP id l29mr21381335pfj.14.1545243083742; Wed, 19 Dec 2018 10:11:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545243083; cv=none; d=google.com; s=arc-20160816; b=YpOn4Yw117V/SRDKrfREFC8/oYMrsJfrPmAsFNdbWyhHD+If6C4jjgR09LjPDpT+7t ZUgsL/AzI+NYWYO7WpNFzaIbc2rWH4yzFBEOmTy35ZuwvOp5CbI4ADOMCfVBjcuokKLy JYGp8HWtKJK2r4D4GgGmK4uKZJyh3ZZrc/j5No3biQB9DrsPQz2HJXy0OtnHZp1k8qYB ksezPmwTnsJIuLEI+TKgmgQwDmeXZS0AO/B/48s9ClCWZOMbrr017y3P2eDD2Tex4NXi enbjhZ1ZwzNBLhTYClj0684B4qO8io3SizJeDdAAVDkpRjHO1PjtanxJf/8KcAhWyIFY qU2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=MP1/4g1DQ7lTloE9worJzLsnnZZyeEFC795cJjcYhW8=; b=ccQEmgx3Cd4/nqD+JlVJYowxsIOKdwCaZ/006QgHTErN2Zo11AalPrdLfbtODNGcO/ Z/C8C5bz7Ovfg2sy0Bmj+k30VLgX9y3t1hb316pcE6XsLeQOnzxarts2EhBEWl+UPzQo 4NjSxRGbf0waAEPZwfcE5ZWSMK5Rew+1nQzyR74E7s3a05UrG7MCIVx9lyrCJ8pkQv0I 2as/tsh/8nzZAl5iBINyIR0B3CcVfCA5h3oq0TN9OqUbM0LuJ07bHmWgo4t1VTQyGi+b DstXP6aSlgIpxRwDu+IAc7GDpCfaaN4yR3zlzjEcGZm1+xjnfTGIv0CsjTI8fMJrzzwo gtKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 142si17115098pfy.217.2018.12.19.10.11.07; Wed, 19 Dec 2018 10:11:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728815AbeLSQIy (ORCPT + 99 others); Wed, 19 Dec 2018 11:08:54 -0500 Received: from outbound-smtp08.blacknight.com ([46.22.139.13]:44672 "EHLO outbound-smtp08.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727976AbeLSQIx (ORCPT ); Wed, 19 Dec 2018 11:08:53 -0500 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp08.blacknight.com (Postfix) with ESMTPS id 3A4541C28B4 for ; Wed, 19 Dec 2018 16:08:51 +0000 (GMT) Received: (qmail 29934 invoked from network); 19 Dec 2018 16:08:51 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.229.96]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 19 Dec 2018 16:08:51 -0000 Date: Wed, 19 Dec 2018 16:04:01 +0000 From: Mel Gorman To: Vlastimil Babka Cc: Linux-MM , David Rientjes , Andrea Arcangeli , Linus Torvalds , Michal Hocko , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing Subject: Re: [PATCH 08/14] mm, compaction: Use the page allocator bulk-free helper for lists of pages Message-ID: <20181219160401.GA31517@techsingularity.net> References: <20181214230310.572-1-mgorman@techsingularity.net> <20181214230310.572-9-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 18, 2018 at 10:55:31AM +0100, Vlastimil Babka wrote: > On 12/15/18 12:03 AM, Mel Gorman wrote: > > release_pages() is a simpler version of free_unref_page_list() but it > > tracks the highest PFN for caching the restart point of the compaction > > free scanner. This patch optionally tracks the highest PFN in the core > > helper and converts compaction to use it. > > > > Signed-off-by: Mel Gorman > > Acked-by: Vlastimil Babka > > Nit below: > > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -2961,18 +2961,26 @@ void free_unref_page(struct page *page) > > /* > > * Free a list of 0-order pages > > */ > > -void free_unref_page_list(struct list_head *list) > > +void __free_page_list(struct list_head *list, bool dropref, > > + unsigned long *highest_pfn) > > { > > struct page *page, *next; > > unsigned long flags, pfn; > > int batch_count = 0; > > > > + if (highest_pfn) > > + *highest_pfn = 0; > > + > > /* Prepare pages for freeing */ > > list_for_each_entry_safe(page, next, list, lru) { > > + if (dropref) > > + WARN_ON_ONCE(!put_page_testzero(page)); > > That will warn just once, but then page will remain with elevated count > and free_unref_page_prepare() will warn either immediately or later > depending on DEBUG_VM, for each page. > Also IIRC it's legal for basically anyone to do get_page_unless_zero() > and later put_page(), and this would now cause warning. Maybe just test > for put_page_testzero() result without warning, and continue? Hm but > then we should still do a list_del() and that becomes racy after > dropping our ref... > While there are cases where such a pattern is legal, this function simply does not expect it and the callers do not violate the rule. If it ever gets a new user that makes mistakes, they'll get the warning. Sure, the page leaks but it'll be in a state where it's unsafe to do anything else with it. -- Mel Gorman SUSE Labs