From patchwork Mon Apr 24 13:45:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13222192 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 067F6C77B61 for ; Mon, 24 Apr 2023 13:45:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73EF56B0071; Mon, 24 Apr 2023 09:45:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6EF146B0074; Mon, 24 Apr 2023 09:45:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DD886B0075; Mon, 24 Apr 2023 09:45:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 4F7886B0071 for ; Mon, 24 Apr 2023 09:45:58 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DF919C01D5 for ; Mon, 24 Apr 2023 13:45:57 +0000 (UTC) X-FDA: 80716407954.19.F11A496 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf08.hostedemail.com (Postfix) with ESMTP id E19C316000B for ; Mon, 24 Apr 2023 13:45:54 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf08.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682343956; 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:references; bh=of4y4r11HnMBjpqe6J5ROFKicQ684iyvaOjw+qGJf5k=; b=vFmM2u7Me6uWwmCJWfsneKa1emclrLPr0vt2eKlip4Q6gHMdF3uK1aMyygg6P4dYVbybQm qqbBGsi4upOy7BJ8l0urwSDJTbTwdrjkBeNe+BPu/1VYBes+LuJhTQcwxGKJpBC44hEFnc u8l9iPCrgpmRKrhVAGju2ywPgvXf5ro= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf08.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682343956; a=rsa-sha256; cv=none; b=o3ADhy+hrfNG4SGzn5WtpiFPARFMt3xP/5bWCdtqRJVZiUmscwECQMJNk0b4fRQlS1VwoJ lXuYpJX5F1mB8r7jIR60x0dQo8waAZR+JkaGsD4dn5aWbTuwXyI25ByhZ5GaG34zW8BSIK FYxoqHwW6StUoMbP9uQdanQQRXeNJYU= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0Vgw4CI-_1682343948; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Vgw4CI-_1682343948) by smtp.aliyun-inc.com; Mon, 24 Apr 2023 21:45:49 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: rppt@kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, vbabka@suse.cz, mhocko@suse.com, david@redhat.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] mm/page_alloc: drop the unnecessary pfn_valid() for start pfn Date: Mon, 24 Apr 2023 21:45:39 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E19C316000B X-Stat-Signature: kitscx45b4a3nun1dyi94x58wxzeo6ef X-Rspam-User: X-HE-Tag: 1682343954-359674 X-HE-Meta: U2FsdGVkX18+cNa6qsk8Uvw4+gEtbTSAKO1kqxa8jUHfQu9hyu9fR1AxYZ5MFBvvshlL3+C0qw3clRUNVYOnatin0zuOjqKNC7OGQeqjdHnKsmg4mI88SypAJIIHz0u+itCq/cdI1SfcXIZuEL2w/UFQm61cX91HUbm6JE217BoHxgrczk14kGQV7kV8M6UvZisz6ybkpN+MR86nlHx0SH56iUc2ypJO5rl8TQE1Xr3raBpUHP4mR+5Dc4pbZVZ88PbUuIrdgrXdHMq9iP28ZXUWI+uieCVZnWiKUFcAnFT8itle9KFf25WfA4sg3KcJ9Yyj1kWXrQFXqmGrcC4oQ+vaB3oa8nk5hmlm3ktMSNODfbocZsGnCZJsdYKpbylOUU1IepIuG84q6sxNu/bauEaklflExaFhtYutN/PoOsRy5LtZAtsC2oU5G67vam0DeJ3LSasHebBSy/ZXT2NGTbTf1sccc7qRD6ybPGF1AgrW8m3O7WS4NyearH1CjTDCZqP8KK4Pa2XpJpMfyNwqLyQASsSFiHY6mlvFsIfLU7kTAR9Fleo6OWiAXzwh6QcFA3eAx364egEuSGnAHuG7LGnRdRlW3uzkm/VsSmlUvV2MbJCqA+hGwtvHVTTb03e/J76jFuN2hHRgZGh5TNGSk6oY5q+lE/s1zqIuFm4dIy+xl15FIqGaBAk8KEBW4MrDwcnBmEU/ss+5020yIIzjOfa6MfTmQu2qQWoqbgaC3s6FJ+Dpb64tvcPMq2r31CadxHARSZOEMEavIksczAkoXKJxF8+DA+hAi5xOUROJuSTEMFjqhgKD82joxkeoDBVW5Ss6QL+RGncuLheq/5pLgLSA5SvmMOiAdT5MLbEO8hqNGWpPbAMdgefsjRVmTg5Mv/i+FmP1HTa+244KLTrD95F3PDKGmMbpVrROtFTyO5WPkAH6aF3JcF4Jms2JPgdxXPz9v4zp92GIs7Kpr0h o7Ro/C6w Gr1elXeM6f8mUx/5KCdeVWS9pVKi63z2zfOThjA9BvZWXGChR4cm3STrYdmSyKfzjEG5qX46o2S8vcIsg98rkR5TNvUQk+U7sWssZTrJbLpirWZx4SiGTd2i/lyTaF9tyIssYp7E4Rd5xmDLxzPny458/MVfifKJtWhu0z5sbD2ZVVt3+rBO8TSLZ187Pufp8kUuU2TFr4+0FDbyxr5J82p8OWjF25j2Q4CejvdwCzDvr0sqSgz5gMhnYEg== 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: __pageblock_pfn_to_page() currently performs both pfn_valid check and pfn_to_online_page(). The former one is redundant because the latter is a stronger check. Drop pfn_valid(). Signed-off-by: Baolin Wang Reviewed-by: David Hildenbrand Reviewed-by: "Huang, Ying" Acked-by: Michal Hocko --- Changes from v2: - Update the commit message per Michal. Thanks. - Add acked tag from Michal. Changes from v1: - Collect reviewed tags. Thanks David and Ying. --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9de2a18519a1..6457b64fe562 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1512,7 +1512,7 @@ struct page *__pageblock_pfn_to_page(unsigned long start_pfn, /* end_pfn is one past the range we are checking */ end_pfn--; - if (!pfn_valid(start_pfn) || !pfn_valid(end_pfn)) + if (!pfn_valid(end_pfn)) return NULL; start_page = pfn_to_online_page(start_pfn);