Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp6605pxk; Wed, 16 Sep 2020 15:24:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1k8GuX+phDnT29fADzn0TGrl/sZMIhh+hXfaNB+K/rsNt6myzFatBB6HrBEgShJM3cmT4 X-Received: by 2002:a17:906:35d5:: with SMTP id p21mr27382923ejb.194.1600295077213; Wed, 16 Sep 2020 15:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600295077; cv=none; d=google.com; s=arc-20160816; b=o3oDVYr0JXTMRT2JQI4qwpY+JtbveRRIDBvLkqmkG8QgxKaRXpTOt32lx9UtKAxRX2 O4RvLDRv7CrW1gk0e3QS2KXYZO0jSJTJi9VevTcTwe29vAe8civt+XcD8/yz2RVvFy6Y cFuM+7AlNFrqEyynvYIhs1qirV2SR195IBbd8CXXRCA33+c/HOMv0fuxd7jvFm6PHaDi W/wdgjrzn7B7IIxp5M+7pF0xkn3t6CYEx2+YC4t8j2s/C+cK/k678937kqFRVRuC0fVa rJ4gwVh0lPv+wefUVA6C0K0803l4KGC7Qj/Zdb+0hK/kpus096eA4/a7d0+zK8Lu3mRn 02rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/6p2UL06xRCrtfganU+UNWFu+nueRBEvuh8BmgJZ8II=; b=QPxw/3OjkdDNDCMJHEDNKEdEPdjm2R7M7oh/6STf54yGgUe8lZNHqP2WzrFI6fGfCv /6HksSK849uhXhWj6MuzctBQ6kWRIuttZcVpfJoVnWpcCy3HkTDSa4Lc6uRRCU8VkaZp vJ3mPvAA7ELPHqIYcJRmAENPVfJNDgMYxpd1dE95ZnwTYKE+s9uGSLJL4B0naBv7PgiI Zb5oavlBpLVC2ZtkXB4/iK86fRF++Gb15wLFPcnrNrQ+dnTqJ0l9GInV/MzcSDblqN8+ blHWCGn6xMcTFtOs37JFY36CaWvAS5OimJnpxcXP7oL4fOTF0yv/m7tKDb3lXzkeKh9l 4/qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fTJMcutr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si13041408ejq.317.2020.09.16.15.24.14; Wed, 16 Sep 2020 15:24:37 -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=pass header.i=@gmail.com header.s=20161025 header.b=fTJMcutr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726588AbgIPWXH (ORCPT + 99 others); Wed, 16 Sep 2020 18:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbgIPWXC (ORCPT ); Wed, 16 Sep 2020 18:23:02 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26E36C0698CA; Wed, 16 Sep 2020 14:44:26 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id r9so10037727ioa.2; Wed, 16 Sep 2020 14:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/6p2UL06xRCrtfganU+UNWFu+nueRBEvuh8BmgJZ8II=; b=fTJMcutrq6igd5vYMabKNTl2pV3QLLIVga8eZVWB3Qo8LD5CuAU2xBCagWdvlNfz7Y SdgLDHmtx+cP77RccgrN17Zpod+wgXnVDWU4BWCp8glD8TmR0CgYjIK7sLhk3gCv4jka 0gbLLTASvnEGY2kVqdeZEAAj+Xc+ag6xxs2n1cu0ypLrogcOS57JfDYiPaxg0LJA89D3 bES/LQ47vgte8onzKDnKVVIsfe4evM0ux9J7ojZJx4ruWYRLDpiMdRs++WmWMiRluaDE RkpwwSpAnZ0yEClbYo3zllxy1Ya+SnHZx3iZ/1TrKJfNpfmg6ZilGkn/hSmOuJJfnWy3 zo8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/6p2UL06xRCrtfganU+UNWFu+nueRBEvuh8BmgJZ8II=; b=NmvgBL/tm7ZQFfkp7AtW9keatgjkfW4KrlcBvy459hJnFLLAffwbrB61ju0Sp7az6g T3mSBrb4bpwl7uW6/JXpaehLFdwsCIVLzglq1N5wGPV2SgwRTuuEqRro3zvYtkBQQ8oY XIF+veh2aPGZi5vJQ/kchOsFaX7B0m8aX9WtAmRQ2ciVIHsVGH3HM5pG+AO/pW528bWF LD+U/XZV1mjSgjFX4CjDuL8sDsj8Bk7aARdgSJ/mYuJEc0ByJ7q/aL+2MeX+vRKWZoPd 9j53uiUiQuYkg3TObev2ww/gWQPeMbu53aFUGIPVhXRVjhJhrpgaVQb9Yz/vfCZ/MuJM Hs1Q== X-Gm-Message-State: AOAM530rCXwvZnEVZpn2i0GF79HkomyxqsJpx93bQbna7ZZWXN0nKcnn zRRTDZ0IJt/zt/JVzv7t4WRCuI1tBk+A4qvBSNN3f5fDDXk= X-Received: by 2002:a6b:7a41:: with SMTP id k1mr21469290iop.187.1600292665347; Wed, 16 Sep 2020 14:44:25 -0700 (PDT) MIME-Version: 1.0 References: <20200916183411.64756-1-david@redhat.com> <20200916183411.64756-2-david@redhat.com> In-Reply-To: <20200916183411.64756-2-david@redhat.com> From: Alexander Duyck Date: Wed, 16 Sep 2020 14:44:14 -0700 Message-ID: Subject: Re: [PATCH RFC 1/4] mm/page_alloc: convert "report" flag of __free_one_page() to a proper flag To: David Hildenbrand Cc: LKML , linux-mm , 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 , Vlastimil Babka , Wei Yang , Oscar Salvador , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 11:34 AM 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 > --- > 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); > } > > /* Seems pretty straight forward. So we are basically flipping the logic and replacing !report with FOP_SKIP_REPORT_NOTIFY. Reviewed-by: Alexander Duyck