From patchwork Tue Jun 23 12:41:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11620651 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E49B990 for ; Tue, 23 Jun 2020 12:42:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B24CD20776 for ; Tue, 23 Jun 2020 12:42:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B24CD20776 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 73E2D6B000A; Tue, 23 Jun 2020 08:42:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 715486B000C; Tue, 23 Jun 2020 08:42:28 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DAD76B000D; Tue, 23 Jun 2020 08:42:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 463826B000A for ; Tue, 23 Jun 2020 08:42:28 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 05CDA1EFD for ; Tue, 23 Jun 2020 12:42:28 +0000 (UTC) X-FDA: 76960439976.25.steel17_0a0746d26e3b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id C6BDF1804E3A0 for ; Tue, 23 Jun 2020 12:42:27 +0000 (UTC) X-Spam-Summary: 1,0,0,d8bc140627055895,d41d8cd98f00b204,richard.weiyang@linux.alibaba.com,,RULES_HIT:41:355:379:541:960:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1534:1540:1711:1714:1730:1747:1777:1792:2198:2199:2393:2559:2562:3138:3139:3140:3141:3142:3351:3865:3871:3872:4250:4321:5007:6119:6261:7875:7903:9036:10004:11026:11473:11658:11914:12043:12296:12297:12555:12895:12986:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14721:21080:21627:21990:30054:30065,0,RBL:115.124.30.44:@linux.alibaba.com:.lbl8.mailshell.net-64.201.201.201 62.20.2.100;04y86pyxafyg4b84nu8bf8ms3s8hoyp8owmau76tqyskj3am1onpfziub59wkxu.qx5cobtiew3g77uikzn4zyk7ezsmqy4e91xyyhzon1mkukwop6n8qpqupw8c5rp.s-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:53,LUA_SUMMARY:none X-HE-Tag: steel17_0a0746d26e3b X-Filterd-Recvd-Size: 2109 Received: from out30-44.freemail.mail.aliyun.com (out30-44.freemail.mail.aliyun.com [115.124.30.44]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Tue, 23 Jun 2020 12:42:23 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01358;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0U0VwpCf_1592916131; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U0VwpCf_1592916131) by smtp.aliyun-inc.com(127.0.0.1); Tue, 23 Jun 2020 20:42:11 +0800 From: Wei Yang To: mgorman@suse.de, akpm@linux-foundation.org, richard.weiyang@linux.alibaba.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mm/page_alloc.c: extract the common part in pfn_to_bitidx() Date: Tue, 23 Jun 2020 20:41:59 +0800 Message-Id: <20200623124201.8199-2-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20200623124201.8199-1-richard.weiyang@linux.alibaba.com> References: <20200623124201.8199-1-richard.weiyang@linux.alibaba.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: C6BDF1804E3A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: The return value calculation is the same both for SPARSEMEM or not. Just took it out. Signed-off-by: Wei Yang --- mm/page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 727751219003..efc2c355ac52 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -459,11 +459,10 @@ static inline int pfn_to_bitidx(struct page *page, unsigned long pfn) { #ifdef CONFIG_SPARSEMEM pfn &= (PAGES_PER_SECTION-1); - return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; #else pfn = pfn - round_down(page_zone(page)->zone_start_pfn, pageblock_nr_pages); - return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; #endif /* CONFIG_SPARSEMEM */ + return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; } /**