Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp591979pxk; Wed, 16 Sep 2020 11:37:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzNphzEzDnrmAJ0YwBZ4e8ZkcZwuS+mbtljE2IaBdEuoncilG+/48gHHTK2b4O1D/WzP6a X-Received: by 2002:a17:907:6f6:: with SMTP id yh22mr26898104ejb.268.1600281476334; Wed, 16 Sep 2020 11:37:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600281476; cv=none; d=google.com; s=arc-20160816; b=KBODOY+ml7Q/Qz8gOeg4+gDTa51H9lCoF30NxFT0pix5IlC95ZEzz2sJLC2DqNJuFk JCjP3LyR1PlrL1Wude68z8Ry9EAA7vsB8SGVYHDd9X2EEA5SmXxZVsHS7wl3muM2oFEl SohnOwVM4oAK9LDMeg7J/qWXimYlLm8QZKq81lKdry1b24THJNFWaKvL05QeYOYzWFLs pPnTSzTvBR3DHBETFO3bqcs6uVyrxbZWJaAc3nxZpI4e1SgWc2rCjkA37JhVDOstno1U DSABFG4m8V6wtrHO4G3oLSnAdR4c+JhxGjXKs5q48CJv7dH6ob7Ri7mnW+9ndu9G1RGP cdow== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XwubkINL1Uor4z8FYu3b+W/GYdIzfTemmcEGbq8cpJ0=; b=p1bQUjQ0zYOb/doE/kJtsiPNrFVoel/fqzDpQpsfjq4lDNqVCELeSPoWzTJ5N4nyWb e9S1/NxT73XuBli4xi/PiTY8SQMVA3+omr6kkQg/z1qlikFR8NQss3Bw9yZuvtS0VNW7 B8ehALJ7OZ/QR44OcVv3zRYqZV7/wScSVjxiRaoREvrv0DfSMPB2EI4MFiOwZGjIojoc Ygc/RXNS1aSFKgPqA1N88UjhqWBeqX9TpiSaySqWR+ErvFoxUVul1p2hGSe3CKX+q4uo JeDcZZzECJ/pgRIqszfTkrwqhAscfxYZGQV941mEoBAAjBB6B5R67eOiuRHJCQRWrYbO Sm+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=InLW9gWG; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f7si12569237ejt.351.2020.09.16.11.37.34; Wed, 16 Sep 2020 11:37:56 -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=@redhat.com header.s=mimecast20190719 header.b=InLW9gWG; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728178AbgIPSep (ORCPT + 99 others); Wed, 16 Sep 2020 14:34:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52813 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728159AbgIPSec (ORCPT ); Wed, 16 Sep 2020 14:34:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600281270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XwubkINL1Uor4z8FYu3b+W/GYdIzfTemmcEGbq8cpJ0=; b=InLW9gWGOIee59Ydokq+OW2Axg4TIrU8kQpw2nqJpnpBPtcZZ86dFebTTDMkL+oWKcHJC3 uFf24/sFtBCvMxTk06UNRLffezS9naiPTeTb5hCiIgvkkQx4lMHs+rzkJw4vaN21bv+8/v PmdsDED6Xx2Cz6VD44CkRXpl1Ja/puc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-163-iu1WFwNHM5mEmTQLNOBZaA-1; Wed, 16 Sep 2020 14:34:26 -0400 X-MC-Unique: iu1WFwNHM5mEmTQLNOBZaA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5321B801AC4; Wed, 16 Sep 2020 18:34:24 +0000 (UTC) Received: from t480s.redhat.com (ovpn-113-190.ams2.redhat.com [10.36.113.190]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BCE119D61; Wed, 16 Sep 2020 18:34:20 +0000 (UTC) From: David Hildenbrand To: 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 , David Hildenbrand , Alexander Duyck , Mel Gorman , Michal Hocko , Dave Hansen , Vlastimil Babka , Wei Yang , Oscar Salvador , Mike Rapoport Subject: [PATCH RFC 1/4] mm/page_alloc: convert "report" flag of __free_one_page() to a proper flag Date: Wed, 16 Sep 2020 20:34:08 +0200 Message-Id: <20200916183411.64756-2-david@redhat.com> In-Reply-To: <20200916183411.64756-1-david@redhat.com> References: <20200916183411.64756-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } /* -- 2.26.2