From patchwork Wed Nov 23 13:40:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wonder_rock@126.com X-Patchwork-Id: 24996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b599:b0:88:f841:fdc9 with SMTP id df25csp2165828dyb; Wed, 23 Nov 2022 06:22:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf69N1r9VzTY+tGZ20350dQ1JxZdviQAOrpNjw5zsObEBeHWyv74uhxbOswMvsTNXwiAzbJ1 X-Received: by 2002:a17:90a:9c07:b0:218:9f75:deae with SMTP id h7-20020a17090a9c0700b002189f75deaemr19623686pjp.58.1669213327925; Wed, 23 Nov 2022 06:22:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669213327; cv=none; d=google.com; s=arc-20160816; b=zrvlWEjfY4YFbII0Mq58vMtJgiuVPBgtuGw73YtxNJ/lceZvO+ay7mvJBUxfNWhImB h6F21qyclbJIPBOl2Vr+wnmFV9iNvzxWeXgJ0hL15U+6RtT/bXHItNQRIHaGrKrPQARi qOsL/cmBolotABWLrDAs6gqQEuzeHzAe+wyjb1JgIEJegbbtLYDnqwQ2h77uaHkbJmft H/PIxCIHEwSx0KygE/zWapx9iRSpUfBuzdboXe2wZWHOGt/KXotnw0ohY9S7d2JEHCaL aPKLsvZU+IT7tHxpVOIxFQlCpqdTwJUnBbJn5bOKeX/eu0fTtRjq6wFt4vQ8y6rXiwjl 07DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=x8W5fh9VbHoZWZ6ymIAUg8ezurxWq9/jC6mUoLoDw1Q=; b=HxT9yOIGpcRFEW64ZQj+m3v7A8VWa1opM6x2R94KtDx4jCZtfryAQFJtKIeMGtb/on qQE25s0l6f3WFNCBYUNfN4qVnH+XGXdavB8HHBCQAWwld5vcZtvjI9JqUZArVRWxx+xj YyxMw3HTmJqSc+NQYt2PL5xjRSWxE8M4Ahkd9Jhd1JRVqyW5+WsSjTJKfrDsHE1hUEHe NqQzyfp/PP6xGXEhatl9wQ7SfpiDhctlrxuYmKu8oMeLYeugbOYQv4ajGTZKAfOQLUPP zrgkk/DWwdoA0bpT7uXJZIA0FIBbua0RQDDzECmtSfSBX1JZ2kDZbh8bwxbWAs4L6QiN 1cOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=MYXMqZXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i25-20020a635419000000b0046f57b135cesi15504811pgb.745.2022.11.23.06.21.53; Wed, 23 Nov 2022 06:22:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=MYXMqZXe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237822AbiKWOLO (ORCPT + 99 others); Wed, 23 Nov 2022 09:11:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237626AbiKWOLL (ORCPT ); Wed, 23 Nov 2022 09:11:11 -0500 X-Greylist: delayed 1803 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 23 Nov 2022 06:11:08 PST Received: from m126.mail.126.com (m126.mail.126.com [123.126.96.242]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5F290B92 for ; Wed, 23 Nov 2022 06:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=x8W5f h9VbHoZWZ6ymIAUg8ezurxWq9/jC6mUoLoDw1Q=; b=MYXMqZXeTIN/UKn+cnY7R AtqJQvqhloF4QjKVbTHXCt8qSfGIDZ9DLvX6BrZ651SLJJuKxjvV1rFB/2gis/af 9bVQDWnrTmUKwVVUufy9twX5G9gdgA7fuV7+MPv9YkKvvBpB9TP1WuMlgBaS2a8A O9GvVBW6sO/rSkGXtZvR+E= Received: from localhost.localdomain (unknown [221.228.128.183]) by smtp12 (Coremail) with SMTP id fORpCgAnN0TjIn5jjy+BAA--.33586S2; Wed, 23 Nov 2022 21:40:53 +0800 (CST) From: wonder_rock@126.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Deyan Wang Subject: [PATCH 1/1] mm/page_alloc: merge two get_pfnblock_migratetype() into one Date: Wed, 23 Nov 2022 21:40:43 +0800 Message-Id: <20221123134043.33896-1-wonder_rock@126.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: fORpCgAnN0TjIn5jjy+BAA--.33586S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Wr17tFWrAr1rKFyfGF1fCrg_yoWDZFg_ua nFvrs7Cr43tF9F9r47Awn7JF97t3Z5CFyxWa1rJrsxAFWUXFn7tF4DJrs3CrZ8WFsIgry8 C3WvvFZIkw1IqjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7sRtZ2a7UUUUU== X-Originating-IP: [221.228.128.183] X-CM-SenderInfo: xzrqvv5ubu0ubn6rjloofrz/1tbiuQXCgVpD-MRFVAAAsP X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750297034684050791?= X-GMAIL-MSGID: =?utf-8?q?1750297034684050791?= From: Deyan Wang It is safe to get_pfnblock_migratetype() in critical section, so just call get_pfnblock_migratetype() once. Signed-off-by: Deyan Wang --- mm/page_alloc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6652df1f5cc8..c7ba9d65d1c0 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1704,13 +1704,8 @@ static void __free_pages_ok(struct page *page, unsigned int order, if (!free_pages_prepare(page, order, true, fpi_flags)) return; - migratetype = get_pfnblock_migratetype(page, pfn); - spin_lock_irqsave(&zone->lock, flags); - if (unlikely(has_isolate_pageblock(zone) || - is_migrate_isolate(migratetype))) { - migratetype = get_pfnblock_migratetype(page, pfn); - } + migratetype = get_pfnblock_migratetype(page, pfn); __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); spin_unlock_irqrestore(&zone->lock, flags);