From patchwork Fri Nov 5 20:40:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12605575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BECCC433F5 for ; Fri, 5 Nov 2021 20:40:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EA0776056B for ; Fri, 5 Nov 2021 20:40:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EA0776056B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 175C6940066; Fri, 5 Nov 2021 16:40:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 12992940049; Fri, 5 Nov 2021 16:40:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F07D4940066; Fri, 5 Nov 2021 16:40:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0119.hostedemail.com [216.40.44.119]) by kanga.kvack.org (Postfix) with ESMTP id E0483940049 for ; Fri, 5 Nov 2021 16:40:13 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A59C170016 for ; Fri, 5 Nov 2021 20:40:13 +0000 (UTC) X-FDA: 78776043906.18.D7058F3 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP id 14D6ED0000B9 for ; Fri, 5 Nov 2021 20:40:03 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 5674460FBF; Fri, 5 Nov 2021 20:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636144812; bh=8zmJ95KZQvysgWDXL5evRtpUL+lSnaX+NEczWmElFno=; h=Date:From:To:Subject:In-Reply-To:From; b=j/4GhRGOxKDq6ojiiUiV8HWRO+GCCI/4pasOY0LG9E/M7Uv7dwbDDmPoeRkn8MTko TURB6Y74ZrSg5QvCt8Fl7DwQ1ujzXc4Fg1eKO0FzH39xtWaEUhfzI3p4fUyI0C98Iu nfxC9ByXNA8KMPxHSUqPXu3ZE7pL2ajL8P+ZF3Ms= Date: Fri, 05 Nov 2021 13:40:11 -0700 From: Andrew Morton To: akpm@linux-foundation.org, david@redhat.com, linmiaohe@huawei.com, linux-mm@kvack.org, mgorman@techsingularity.net, mm-commits@vger.kernel.org, peterz@infradead.org, sfr@canb.auug.org.au, torvalds@linux-foundation.org, vbabka@suse.cz Subject: [patch 106/262] mm/page_alloc.c: use helper function zone_spans_pfn() Message-ID: <20211105204011.W9Nu5EuuH%akpm@linux-foundation.org> In-Reply-To: <20211105133408.cccbb98b71a77d5e8430aba1@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 14D6ED0000B9 X-Stat-Signature: b5wpt51xrzf1h6764rrjie1j6zuhqa9e Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="j/4GhRGO"; spf=pass (imf20.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1636144803-430978 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Miaohe Lin Subject: mm/page_alloc.c: use helper function zone_spans_pfn() Use helper function zone_spans_pfn() to check whether pfn is within a zone to simplify the code slightly. Link: https://lkml.kernel.org/r/20210902121242.41607-5-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Acked-by: Mel Gorman Reviewed-by: David Hildenbrand Cc: Peter Zijlstra Cc: Stephen Rothwell Cc: Vlastimil Babka Signed-off-by: Andrew Morton --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/page_alloc.c~mm-page_allocc-use-helper-function-zone_spans_pfn +++ a/mm/page_alloc.c @@ -1583,7 +1583,7 @@ static void __meminit init_reserved_page for (zid = 0; zid < MAX_NR_ZONES; zid++) { struct zone *zone = &pgdat->node_zones[zid]; - if (pfn >= zone->zone_start_pfn && pfn < zone_end_pfn(zone)) + if (zone_spans_pfn(zone, pfn)) break; } __init_single_page(pfn_to_page(pfn), pfn, zid, nid);