Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3659578imu; Tue, 18 Dec 2018 01:57:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/WAibHeihbkCGTA4O+kStz7+W0tmQlJ/2milpmxmwhuQd44l0pNdpWSK3CnuMLwyk4v5YBi X-Received: by 2002:a17:902:3283:: with SMTP id z3mr16133660plb.76.1545127042974; Tue, 18 Dec 2018 01:57:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545127042; cv=none; d=google.com; s=arc-20160816; b=E9L8SNWU4HLa0ALxGUYOB+R5Cj/qu5ZDkNUs8NLLkJV4rmOi5P/7ur3+g5YdUG9lvd On4kWnCgoMCFFD/6EAyKH9qOce6urRi2TfQqpR0dBWqlW9a7jvpwT4ThATU3ELyuguuT Y36exhrpRk9dsNwwmLWi2bEUleilB0tk87i8T6WhI6Nge8/pZqf5PraSyaJgi955QgEV /HOFpc83pSOZFETiV3RIXHoDLkoeD4u34LMejWcCdfprfRn+RmKRtD57Ahqwe0RBNvtQ GpQzNdBkOcdVecmdH5Ni/DEf3d703VAQT9PpGTbNv9V8/k9rzs4e3xOxTunvSmzvjKi+ V06g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=sdm+oHX7XCcsTlxns3Hvn0USkVzbM1qm+5FgUTTk9Ns=; b=IcnFi8rCrTWSTuTufM6OLHkcVcMI+DxzUoQ/3Df/DhC9D8lnmgnKAUJgPPwexWRFO/ e4QM7HfZrBo7Wxxhi2+JmTxDXrMpTNws/KBJ85Qlg2obDOtfapxdpDM51Y1ZKfJoSDgf 7y5TvCXWIokxDRue+NTlTgT9e8IBtxqiZnPzKI0Tqr8qUX5NlTFVJWGgH7VIuVkoLvkl XzvlySuINvKwNZ3WDZ4R6mxt6ZUlsoujihnKdoQ0lOXM5heJJGB+gnTvSs1MurF9tn57 a3/GA33N/mua5VhxYNfg9BJDYpCq0L6SaCCL3zE5HgkmPjMMaLclfEzVznVfZp/tBy9d s8XA== 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 g11si13619670pgu.347.2018.12.18.01.57.07; Tue, 18 Dec 2018 01:57:22 -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 S1726491AbeLRJze (ORCPT + 99 others); Tue, 18 Dec 2018 04:55:34 -0500 Received: from mx2.suse.de ([195.135.220.15]:58002 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726365AbeLRJze (ORCPT ); Tue, 18 Dec 2018 04:55:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3924BACB8; Tue, 18 Dec 2018 09:55:32 +0000 (UTC) Subject: Re: [PATCH 08/14] mm, compaction: Use the page allocator bulk-free helper for lists of pages To: Mel Gorman , Linux-MM Cc: David Rientjes , Andrea Arcangeli , Linus Torvalds , Michal Hocko , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing References: <20181214230310.572-1-mgorman@techsingularity.net> <20181214230310.572-9-mgorman@techsingularity.net> From: Vlastimil Babka Openpgp: preference=signencrypt Message-ID: Date: Tue, 18 Dec 2018 10:55:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: <20181214230310.572-9-mgorman@techsingularity.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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... > pfn = page_to_pfn(page); > if (!free_unref_page_prepare(page, pfn)) > list_del(&page->lru); > set_page_private(page, pfn); > + if (highest_pfn && pfn > *highest_pfn) > + *highest_pfn = pfn; > } > > local_irq_save(flags); >