From patchwork Fri Aug 11 11:59:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13350060 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 C7C95C41513 for ; Fri, 11 Aug 2023 03:59:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B2676B0071; Thu, 10 Aug 2023 23:59:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 262E76B0072; Thu, 10 Aug 2023 23:59:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12A176B0074; Thu, 10 Aug 2023 23:59:48 -0400 (EDT) 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 049C06B0071 for ; Thu, 10 Aug 2023 23:59:48 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CD2191602C6 for ; Fri, 11 Aug 2023 03:59:47 +0000 (UTC) X-FDA: 81110470014.23.1617AD3 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf06.hostedemail.com (Postfix) with ESMTP id ADB08180007 for ; Fri, 11 Aug 2023 03:59:44 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=none; spf=none (imf06.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691726385; 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; bh=HbAGcM3xOLysNbgfCEylmUxgdRG2DjjH50klNGsyj1Y=; b=MFe9GGcpYy9Zd+qfOSG6H8viHd5EI8mRkEdjyKkfyBSZVXzc8Zt+ZK91VwPqcoc0yPoXgW ubG9KDmJzzLpblt/yU15Am/6zOGl7UDqX9Bf2rlfuGC82NRILkc4P94dgfwDwL30nzK2+Q DgDLef4rpa7GFZUeaNAX9TtjPlTzm4A= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=none; spf=none (imf06.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691726385; a=rsa-sha256; cv=none; b=F8gtYHIyd8BUY59pdkgTitVIqRQuXNXN8GE3Qr+ystfSAcbuAPA68bOlyTEYahFtXNwBQM aQSDmrsHLr3cVMI3ru6hgAJEYsd3D5zNDBPeC0YylDolfjUp19i74zkSX9NsfiL2PVNS8C yE3oKZ/NeIu1wEsJnIgbyvr+ZIexdI8= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RMVRZ5n73z4f3jM3 for ; Fri, 11 Aug 2023 11:59:38 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP4 (Coremail) with SMTP id gCh0CgB3B6opstVkr4O6AQ--.62491S3; Fri, 11 Aug 2023 11:59:39 +0800 (CST) From: Kemeng Shi To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, mgorman@techsingularity.net, david@redhat.com, willy@infradead.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 1/2] mm/page_alloc: remove unnecessary inner __get_pfnblock_flags_mask Date: Fri, 11 Aug 2023 19:59:44 +0800 Message-Id: <20230811115945.3423894-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230811115945.3423894-1-shikemeng@huaweicloud.com> References: <20230811115945.3423894-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: gCh0CgB3B6opstVkr4O6AQ--.62491S3 X-Coremail-Antispam: 1UD129KBjvJXoWxJrWkXw17urWUArW8JrWfAFb_yoW8tw1Dpa 4xtFyjyF42934a9ayxZF1qvry3Awn8Ww45ArsxK342va45AFy7Wrn3KFyfXF4FqrWxAF15 ZrW5tFykZFnrJ3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBK14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2jI8I6cxK62vIxIIY0VWUZVW8XwA2048vs2IY02 0E87I2jVAFwI0_Jr4l82xGYIkIc2x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2 F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjx v20xvEc7CjxVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYx C7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8 JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRE2NtUUUUUU= = X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: ADB08180007 X-Stat-Signature: ojhra8smwauks3dqt5jkn5asx71nzqed X-Rspam-User: X-HE-Tag: 1691726384-576376 X-HE-Meta: U2FsdGVkX18Yb05C2pxCSdDqCuCXmoOxy8a2RSt7AKI7a79PxgxflrNqf0eRomnio+fsezZJ6GIaAeoIvB0xTTH31q62pqA1DqvHszRdBXabqO1r/LFMLUNoE7DIeRMXg9NCT+z4By6D7xOjnU6ACFCyF1Py/ffVhEmZB7tCuDK8Hkho/avdF4m6VAgRQ6c4Io81H+u/NjRsnBN1JUWPALCvHhrgU3HtOuF8KS39+97bzNeqnavlHCx5ooi6y4aMRQp/z3/02hx7Klxk7iB+cpq1Myfbnm8Vl2ydM0B8VFKUh81a+cAYyw437bdKnJH5dvaV/pVUbDQVzY1VHnZgRI/Cc1HgtCbMaoYu3wDSiT/tvpSwU6DJMejZtZ3hz5i5YX+tj8FSAcpNn5KmrQw7iLREjwoX+rEreUie3qBZhCHlwZtngB6IUPcJ6BB2XKTxDAT3aa5aXEzdrVAWNKLxgL4LcNyfgzTo3G0tX51j/xYYxeokhcLqVwCa33VucBtblZdy3zkg3vA8ngFqG6vzsPD0tJ3x589t0QBwMBG5tZ6/EIV7retkmIwTelu+v2WJZB9uIVaHkduqmYAwwX5jqEJAzUTNato9yJPt9oIhrlscAB+e5Yb4XiJX6/h0AuqYsaRwomOlxUHKPefTT8vMbA3ZzEf5zjDHJ7Uv4LskQlzNm+W5O6VVK1wlae3cWOgloN4yzRJREu+V1HvVrsbqfSg8AeRB/If/HZZ17oYypM821UFYuVbGxhqilV+mrPWDbkm67VtLX+2PvW5xev+c9bbBKE418WPDHoIrcZyAmRzYRp2WAlll09LsIUS4KVhhuT3rcBhn0N3m/9v8/g4zkxUrLaaFowiK8JUvfdnOx+YMjuftjnl3wyj5McydIyeTJu/VCDAK8PIJyjufRG6jXpjSM8TS1poGxcYXnevt4BO09hdeT+mx3zilwXXFoKcClqiWLz9HTbmdhVF4kan Vzpsc0pp OIrmMInFiw5jBXuLom0r+gd69y+ZIhcU3RcJEXv0oU+6Mpmxa1Wz6N5u1Wy1txBsby1356TU/un6/PkM0SEvw8c/7wC9+mQ+NdbO4rQol85Ety1Tb6f3fO+9/MlMjCU7Ir3Fb18KOsaMqYmtVu4ZrIWbQWPXggg+M5u8I8l2EyyAC4LIbHPUCcfmdjcNEc7oVNyYZYGVYu0IUT5G9AIvB1u9DSabAdbAMmb195ogicQGteLkizyCXoGZq83LKDuvYazIxBODzwtecQhJtyVU3Gs7TuPgLaWDTZEbuWvyFFTH9R1yVdnLXvY8AHT2fY+jrpE7X 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: Function get_pfnblock_flags_mask just calls inline inner __get_pfnblock_flags_mask without any extra work. Just opencode __get_pfnblock_flags_mask in get_pfnblock_flags_mask and replace call to __get_pfnblock_flags_mask with call to get_pfnblock_flags_mask to remove unnecessary __get_pfnblock_flags_mask. Signed-off-by: Kemeng Shi Reviewed-by: Matthew Wilcox (Oracle) Acked-by: Mel Gorman Acked-by: Johannes Weiner --- mm/page_alloc.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e884d3fd0d06..6c2294ccc6cb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -371,10 +371,16 @@ static inline int pfn_to_bitidx(const struct page *page, unsigned long pfn) return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; } -static __always_inline -unsigned long __get_pfnblock_flags_mask(const struct page *page, - unsigned long pfn, - unsigned long mask) +/** + * get_pfnblock_flags_mask - Return the requested group of flags for the pageblock_nr_pages block of pages + * @page: The page within the block of interest + * @pfn: The target page frame number + * @mask: mask of bits that the caller is interested in + * + * Return: pageblock_bits flags + */ +unsigned long get_pfnblock_flags_mask(const struct page *page, + unsigned long pfn, unsigned long mask) { unsigned long *bitmap; unsigned long bitidx, word_bitidx; @@ -393,24 +399,10 @@ unsigned long __get_pfnblock_flags_mask(const struct page *page, return (word >> bitidx) & mask; } -/** - * get_pfnblock_flags_mask - Return the requested group of flags for the pageblock_nr_pages block of pages - * @page: The page within the block of interest - * @pfn: The target page frame number - * @mask: mask of bits that the caller is interested in - * - * Return: pageblock_bits flags - */ -unsigned long get_pfnblock_flags_mask(const struct page *page, - unsigned long pfn, unsigned long mask) -{ - return __get_pfnblock_flags_mask(page, pfn, mask); -} - static __always_inline int get_pfnblock_migratetype(const struct page *page, unsigned long pfn) { - return __get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK); + return get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK); } /**