From patchwork Mon Nov 25 21:01:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13885272 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBCF3D59D71 for ; Mon, 25 Nov 2024 21:02:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 659BC6B0092; Mon, 25 Nov 2024 16:01:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 426196B0093; Mon, 25 Nov 2024 16:01:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B5BC6B0099; Mon, 25 Nov 2024 16:01:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D6A726B0089 for ; Mon, 25 Nov 2024 16:01:55 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 86590140DE0 for ; Mon, 25 Nov 2024 21:01:55 +0000 (UTC) X-FDA: 82825839264.24.FBD5989 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf23.hostedemail.com (Postfix) with ESMTP id 81018140015 for ; Mon, 25 Nov 2024 21:01:51 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=i9gH1MvY; dmarc=none; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732568511; a=rsa-sha256; cv=none; b=Y3uP/6JojPgfqb6on/PO4zyYYv7z55TR3tRHDCeDMrJKhg5WYKTxKE0DMNEFwyAY7/BmpC Im/3mV8G7rjeXqXGXGCMEj4VAZJ0jbjAJcSpP1N6Ql5nU3bg/A5tQdSPk4gfHy3dBrcjr6 CZLkwnjNE1sHAeDket4a7MiJWw+3Iew= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=i9gH1MvY; dmarc=none; spf=none (imf23.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732568511; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tZVQtxgbrEODeYoNQSSaa0wSrfaJtTpbtwjWdv648ew=; b=OC1NhesjP4GTxVIzuujyCnTdOUZeNLc//7FSneKDJ54a6bfl8HnTvCqA1PZuxfpiAg2eoq +5U265NxIQ2z/SDV5GS8gKplsedGaorMFiSHlMRcp5KuYQklbL0esOKDMJnYHB5zD6lzJt v77U5MBUGVQZEy7pERohPAbtuKsQ0TU= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=tZVQtxgbrEODeYoNQSSaa0wSrfaJtTpbtwjWdv648ew=; b=i9gH1MvYAdCi6WNbr5238wifLX N0fhzlV9u3MKVl6i+avcQIq+EKOM3DX4Zi2ZU/2FCaYRTkjzOQr8gWbhvsRX6D3yH924u6uhwA3S4 orTQo6r+m/RT+ugFJGQuB4VnRrIWGWOeukYZKaxt3Tc7irlfUQ+51SOPa65xngGSk2j7+uiTba5eY NEFqqnXwOklOw45Aszpk1+WzRqrEDByE75yTdaqddcGaGoesfsaILjBnV/5seRTNvqdYEyk/uOnDI b30bbFwua0O6bu/KnlsODxjLqomf78WdkEg78EvFyX1eTQsJXD9cHuUvikg+AbILC5moK/civbXBD gvsD+yaw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tFgDO-0000000CUDs-3MuH; Mon, 25 Nov 2024 21:01:50 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, David Hildenbrand , Miaohe Lin , Muchun Song , Mel Gorman Subject: [PATCH v3 01/15] mm/page_alloc: Cache page_zone() result in free_unref_page() Date: Mon, 25 Nov 2024 21:01:33 +0000 Message-ID: <20241125210149.2976098-2-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241125210149.2976098-1-willy@infradead.org> References: <20241125210149.2976098-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 81018140015 X-Stat-Signature: yh38on5knyg1ijxim89twqdwc5ha57nj X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1732568511-289209 X-HE-Meta: U2FsdGVkX1/FvA/2lVUeiDqiOwhPAp5zsFFceajCgTU932LSWUIheZva9Y2MuUkaemMDaVHbPD0XXY/CLAO/ih5NAiwH2sv9vemKOK1khVviuLd1SoyDtcfXY69Dkn9NQRlFabNPKTBdqS0/+8mBzybxfW7GiUfnKeFWcV67DsWoFPTMW4/wweeNgakx62fOiGJ6m2goS/duID5MCiLskzLP0SSx/NAwPQ2a55Dl+QAX4V7Mb1yhksrb6xecXtUUafK2M48kZ+RDiD+9Ugl6fwn9YKxC6gm74LuyOCsW5Q9z0Erc/qAff5X3QeJLRAHE+TppHGC3C5qpdBn/OWR6zDGAi0Fb2duMb8Q4klYNZn8E7BKX8sZ3By70lme5scR0EZno9F88MnnYkIGB2vZgHKwM4fJN1cV1GSHCviVJeDMeBsxN0i4skZZCsVodUWF07U9uq7ULxLqAClhGz14k3lgS5kdbE77A/KTYMqOEAkDwYzQUmmcxniFz5O4394moX06DvyJIFHVoeLA+n9P7AAL9CG6YT8bJp0SzmMvB7TfL41e08beTBpdpVH6jfYZALcFmats77L5hLkP9KgVi5W6d0ISsSmmmBEaZS8pMfQG0BZ8xOw0NzI5KxStKGvvNIXDfrVN5IQJdySyKS/9Z2PHpiXt+hw1p5WkEMJO0im2UKP6k7dpHG8i5VXk0pTTp/E6fC5uDCfS+i2Bc24my4eZWz/dK9cvzcyN0qzYHIbaYKHbwsKMjtupd4tUl36oOJLYlZhh7l0I1rAiag6WhDOqTTqeSwZuaynYWntEM8DH2aHnovGZxEs2ZIEmwyCsh2d56B077UMZgU9xIylYX5/SNGvA70Nulaetvo6fIjcB93ZACQPsLqHeMK5/9k4ftxaq+6JGstZjx3hUucCdlbz5EkQkhfS5Y/0ESUg+c7YzOD/2ptG+pvOXVl3+ari52zUzDebuVQdSDqz+4WfQ F3PFcz5I c1C25OPvLFURVz9YuOGyn8/yOjf7L/mnvNGbMW46pA71yXlrPr7AY0pQm7E3qJ7ae5s1wIHJTIa34aMe4R7sXyboht9j/J0RhTMUtPyjoJosKckxVt8gO8MRJ0od/yON8jeWNv2lwuoUII4TGchLkiiOkdzt6EPthfXBOJzPEPntOFOGo2UBSs6q927CZ2UutgIsy3ZxGIs8EsWR6Wna64HhBIoUqgQCCWEI/iiaKmg4qgAIfnbjjlFKG9mGKuxETwIxXSfe7moe2KRSBhouMC2p6evdOE+uPh2AOPVdJ0f6NKGN5+TyZsmHcAkzMAsVBar2+MKO6wLffF+UU9cdPhGy5t2So181k7j17fntXicQmhfcq+0ik/VVurq+yVT5Nu+65L3Jv8bckvH0= 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: List-Subscribe: List-Unsubscribe: Save 17 bytes of text by calculating page_zone() once instead of twice. Reviewed-by: Miaohe Lin Reviewed-by: Muchun Song Acked-by: Mel Gorman Signed-off-by: Matthew Wilcox (Oracle) Acked-by: David Hildenbrand --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a8cd54c02f13..c40a0c29a89c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2700,16 +2700,16 @@ void free_unref_page(struct page *page, unsigned int order) * get those areas back if necessary. Otherwise, we may have to free * excessively into the page allocator */ + zone = page_zone(page); migratetype = get_pfnblock_migratetype(page, pfn); if (unlikely(migratetype >= MIGRATE_PCPTYPES)) { if (unlikely(is_migrate_isolate(migratetype))) { - free_one_page(page_zone(page), page, pfn, order, FPI_NONE); + free_one_page(zone, page, pfn, order, FPI_NONE); return; } migratetype = MIGRATE_MOVABLE; } - zone = page_zone(page); pcp_trylock_prepare(UP_flags); pcp = pcp_spin_trylock(zone->per_cpu_pageset); if (pcp) {