Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp195574pxk; Thu, 24 Sep 2020 03:23:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0m4NsbMjWikvD5z02zs7t5ijOmQpldkUno3SKVxlSBPTLxh3ItLE6RfMOl8hzyK7vUYnq X-Received: by 2002:aa7:dcd3:: with SMTP id w19mr270724edu.18.1600942992482; Thu, 24 Sep 2020 03:23:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600942992; cv=none; d=google.com; s=arc-20160816; b=YG3AqYJhX0fSaW33ClQ2s5jzN22UhM+joDvU/Zwo2FP+83j/SaF4p0J//lvlauhpOy Oc3oT3p7x74krHxnBWWdxyRc+bqQidg+q+64cbeA7vTvtMfO+DzGDJUazeK5+AlV/tYY Xx8Ium0in76Sh3+/uyNeC928PzYIm+PN1o1df//GpG1kjL20b788XOhiPXz0AN9wqnlI iFvqGHEbsMMcSycoVcdcEO7n8cLq5sYs+9sBsBMSjLKgL7UKQCwOqzlCpDbj2bnWMpUm gYPZGniJNgW0Ctn6SjvtlahdujHlk5ctiN7uVSJVsF11wzUl1yDF424GOQ4/zPKQ3nKX Zy7g== 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=TFtSFTUQl2ir0X7VwY5Gxbhoq/1Mivw8dnRQJV494P8=; b=z3D9cF3Iv4cyzYdwvir2JUyUeNH0AtBb+AyyZLnAcmvAxvIC1MoNHD2SrgAVa8yEzN joHPNWy8ITQriEjixcVtSz4gkfINCp32G2MvqiNFmb1NK27Uxqq7m5NXL6ptleLrogxK brgab8GrRhuGittKFq6gJ5O34LkFgw7OndL1j1nUP0RTp+Lrib263zDSJLTiEcGB7c0m 7Duu4b3+AOgRh/SKJSOR5ReEJ+Ut7TXmpeNL7ne6rZ6VC7dHn5r53s/cEfkY3IvRIwrB LU5v78Itq7pgGmJB9AApC5XWqwtEPaIX6HhcQqwd+ylucz2sVB6GMHOixpTNL9ZV5j1s 6jTQ== 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 l14si1723164eje.378.2020.09.24.03.22.49; Thu, 24 Sep 2020 03:23:12 -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; 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 S1727427AbgIXKTv (ORCPT + 99 others); Thu, 24 Sep 2020 06:19:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:54534 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726847AbgIXKTv (ORCPT ); Thu, 24 Sep 2020 06:19:51 -0400 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 9A3F0AF1F; Thu, 24 Sep 2020 10:20:26 +0000 (UTC) Subject: Re: [PATCH RFC 1/4] mm/page_alloc: convert "report" flag of __free_one_page() to a proper flag To: David Hildenbrand , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linux-hyperv@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org, Andrew Morton , Alexander Duyck , Mel Gorman , Michal Hocko , Dave Hansen , Wei Yang , Oscar Salvador , Mike Rapoport References: <20200916183411.64756-1-david@redhat.com> <20200916183411.64756-2-david@redhat.com> From: Vlastimil Babka Message-ID: <82ba4aec-0c69-2461-485a-fa4a7777e5c3@suse.cz> Date: Thu, 24 Sep 2020 12:19:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200916183411.64756-2-david@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/16/20 8:34 PM, David Hildenbrand wrote: > Let's prepare for additional flags and avoid long parameter lists of bools. > Follow-up patches will also make use of the flags in __free_pages_ok(), > however, I wasn't able to come up with a better name for the type - should > be good enough for internal purposes. > > Cc: Andrew Morton > Cc: Alexander Duyck > Cc: Mel Gorman > Cc: Michal Hocko > Cc: Dave Hansen > Cc: Vlastimil Babka > Cc: Wei Yang > Cc: Oscar Salvador > Cc: Mike Rapoport > Signed-off-by: David Hildenbrand Reviewed-by: Vlastimil Babka > --- > mm/page_alloc.c | 28 ++++++++++++++++++++-------- > 1 file changed, 20 insertions(+), 8 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 6b699d273d6e..91cefb8157dd 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -77,6 +77,18 @@ > #include "shuffle.h" > #include "page_reporting.h" > > +/* Free One Page flags: for internal, non-pcp variants of free_pages(). */ > +typedef int __bitwise fop_t; > + > +/* No special request */ > +#define FOP_NONE ((__force fop_t)0) > + > +/* > + * Skip free page reporting notification after buddy merging (will *not* mark > + * the page reported, only skip the notification). > + */ > +#define FOP_SKIP_REPORT_NOTIFY ((__force fop_t)BIT(0)) > + > /* prevent >1 _updater_ of zone percpu pageset ->high and ->batch fields */ > static DEFINE_MUTEX(pcp_batch_high_lock); > #define MIN_PERCPU_PAGELIST_FRACTION (8) > @@ -948,10 +960,9 @@ buddy_merge_likely(unsigned long pfn, unsigned long buddy_pfn, > * -- nyc > */ > > -static inline void __free_one_page(struct page *page, > - unsigned long pfn, > - struct zone *zone, unsigned int order, > - int migratetype, bool report) > +static inline void __free_one_page(struct page *page, unsigned long pfn, > + struct zone *zone, unsigned int order, > + int migratetype, fop_t fop_flags) > { > struct capture_control *capc = task_capc(zone); > unsigned long buddy_pfn; > @@ -1038,7 +1049,7 @@ static inline void __free_one_page(struct page *page, > add_to_free_list(page, zone, order, migratetype); > > /* Notify page reporting subsystem of freed page */ > - if (report) > + if (!(fop_flags & FOP_SKIP_REPORT_NOTIFY)) > page_reporting_notify_free(order); > } > > @@ -1368,7 +1379,7 @@ static void free_pcppages_bulk(struct zone *zone, int count, > if (unlikely(isolated_pageblocks)) > mt = get_pageblock_migratetype(page); > > - __free_one_page(page, page_to_pfn(page), zone, 0, mt, true); > + __free_one_page(page, page_to_pfn(page), zone, 0, mt, FOP_NONE); > trace_mm_page_pcpu_drain(page, 0, mt); > } > spin_unlock(&zone->lock); > @@ -1384,7 +1395,7 @@ static void free_one_page(struct zone *zone, > is_migrate_isolate(migratetype))) { > migratetype = get_pfnblock_migratetype(page, pfn); > } > - __free_one_page(page, pfn, zone, order, migratetype, true); > + __free_one_page(page, pfn, zone, order, migratetype, FOP_NONE); > spin_unlock(&zone->lock); > } > > @@ -3277,7 +3288,8 @@ void __putback_isolated_page(struct page *page, unsigned int order, int mt) > lockdep_assert_held(&zone->lock); > > /* Return isolated page to tail of freelist. */ > - __free_one_page(page, page_to_pfn(page), zone, order, mt, false); > + __free_one_page(page, page_to_pfn(page), zone, order, mt, > + FOP_SKIP_REPORT_NOTIFY); > } > > /* >