From patchwork Fri Sep 16 07:22:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978205 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 92F5AC54EE9 for ; Fri, 16 Sep 2022 07:23:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D88D28D0002; Fri, 16 Sep 2022 03:23:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D11208D0001; Fri, 16 Sep 2022 03:23:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C00658D0002; Fri, 16 Sep 2022 03:23:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B224B8D0001 for ; Fri, 16 Sep 2022 03:23:43 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 72BD2121A3D for ; Fri, 16 Sep 2022 07:23:43 +0000 (UTC) X-FDA: 79917108726.04.5A64BA3 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf30.hostedemail.com (Postfix) with ESMTP id EFAD0800CF for ; Fri, 16 Sep 2022 07:23:40 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MTQSM5lVJzmVSS; Fri, 16 Sep 2022 15:19:47 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:35 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 01/16] mm/page_alloc: ensure kswapd doesn't accidentally go to sleep Date: Fri, 16 Sep 2022 15:22:42 +0800 Message-ID: <20220916072257.9639-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313021; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vd+Ns4nD8dbN7WhMlsMKuVzIP4SEwCr2Vd8cTUpgoLY=; b=4ex50RIOQVHogvExjN+TuXaZZWKsbQuvY3Bu2stC5UBbpEnsSDDzLIPenIIl+FjTc5F05g a0I6zefitoL0ZfG7HGm9Mw21C8pyCO6tAqgIUfK/Qn/sy3kM7G2j586wwcSM+YmGnnI137 H99Bdy9lqd4ox4k+sR3KZ18f/HZ/Lm0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313021; a=rsa-sha256; cv=none; b=ZVQ5adD46r6GM7bwXheHxVH3syVNyZc4vZldWPGuXSDiOoVQnbHv0iLdHEVxVtYr7rKNJf kwJWAYKrlnitYbOOiNRAI39fMMXWaQf45kwQgs1gFSyx2LOpFF9d2hHNpg40wUZF5KrxOY 54DpXsA0FmNUmQt+wi1ZGf2zmu8Qu0k= Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: 347ux3zub4yxb7micoxnkwszwqzdykyg X-Rspamd-Queue-Id: EFAD0800CF X-Rspamd-Server: rspam12 X-Rspam-User: X-HE-Tag: 1663313020-875529 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: If ALLOC_KSWAPD is set, wake_all_kswapds() will be called to ensure kswapd doesn't accidentally go to sleep. But when reserve_flags is set, alloc_flags will be overwritten and ALLOC_KSWAPD is thus lost. Preserve the ALLOC_KSWAPD flag in alloc_flags to ensure kswapd won't go to sleep accidentally. Fixes: 0a79cdad5eb2 ("mm: use alloc_flags to record if kswapd can wake") Signed-off-by: Miaohe Lin Acked-by: David Hildenbrand Reviewed-by: Oscar Salvador --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ef3f51c9815d..35e18514215a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5148,7 +5148,8 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, reserve_flags = __gfp_pfmemalloc_flags(gfp_mask); if (reserve_flags) - alloc_flags = gfp_to_alloc_flags_cma(gfp_mask, reserve_flags); + alloc_flags = gfp_to_alloc_flags_cma(gfp_mask, reserve_flags) | + (alloc_flags & ALLOC_KSWAPD); /* * Reset the nodemask and zonelist iterators if memory policies can be From patchwork Fri Sep 16 07:22:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978228 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 7F0B9C54EE9 for ; Fri, 16 Sep 2022 07:39:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 132E38000C; Fri, 16 Sep 2022 03:39:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BCD58000B; Fri, 16 Sep 2022 03:39:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9E628000C; Fri, 16 Sep 2022 03:39:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D57CB8000B for ; Fri, 16 Sep 2022 03:39:36 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A8BF4405B5 for ; Fri, 16 Sep 2022 07:39:36 +0000 (UTC) X-FDA: 79917148752.19.54408CD Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id 6AB2C1400CE for ; Fri, 16 Sep 2022 07:39:34 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MTQRR0SKQzMmxP; Fri, 16 Sep 2022 15:18:59 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:35 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 02/16] mm/page_alloc: make zone_pcp_update() static Date: Fri, 16 Sep 2022 15:22:43 +0800 Message-ID: <20220916072257.9639-3-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313974; a=rsa-sha256; cv=none; b=7LzTEM1n0mdXnEtEorE9FYMKibPXrAhYSzCfPjQ9DCCsK2bZm5kiRbSOHipvpsG0oYKLtp eylqEbN2+kN/y9fw3SRD8auvDQiDxwaf8Zb79HeoUxHuwLIfccSEVxfot6EwY/ZuC5r3Wa 1//ijT9yn+8TL0GWURdFO7bjgypYkcE= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313974; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lPScR+bZWdMhFCSzsw5BChTefnSK8YcF+D5akKC1bQ4=; b=R4LLb4HPtXmXzNy2a33eGIdWXv9dipxxdjTXYyLmZ8hcHTrVXmimyb842EQVuBw7/9sgEO HL94YZz0bzjQ8YIP6lKDKohshaRUvcqrx89SrxYOe/p+mgidRkWcfCQhRyJdXZwfS0vlhY p1+rhc4dj6ql6HKnhwhiuiQkBCQZpvs= X-Stat-Signature: b61tg75bhc1hqc67tzrjnbk8frk7mzph X-Rspamd-Queue-Id: 6AB2C1400CE Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1663313974-642952 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: Since commit b92ca18e8ca5 ("mm/page_alloc: disassociate the pcp->high from pcp->batch"), zone_pcp_update() is only used in mm/page_alloc.c. Move zone_pcp_update() up to avoid forward declaration and then make it static. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- mm/internal.h | 1 - mm/page_alloc.c | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 883b09f02404..94d8a976c2e2 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -367,7 +367,6 @@ extern int user_min_free_kbytes; extern void free_unref_page(struct page *page, unsigned int order); extern void free_unref_page_list(struct list_head *list); -extern void zone_pcp_update(struct zone *zone, int cpu_online); extern void zone_pcp_reset(struct zone *zone); extern void zone_pcp_disable(struct zone *zone); extern void zone_pcp_enable(struct zone *zone); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 35e18514215a..04559870ed12 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7234,6 +7234,17 @@ void __meminit setup_zone_pageset(struct zone *zone) zone_set_pageset_high_and_batch(zone, 0); } +/* + * The zone indicated has a new number of managed_pages; batch sizes and percpu + * page high values need to be recalculated. + */ +static void zone_pcp_update(struct zone *zone, int cpu_online) +{ + mutex_lock(&pcp_batch_high_lock); + zone_set_pageset_high_and_batch(zone, cpu_online); + mutex_unlock(&pcp_batch_high_lock); +} + /* * Allocate per cpu pagesets and initialize them. * Before this call only boot pagesets were available. @@ -9465,17 +9476,6 @@ void free_contig_range(unsigned long pfn, unsigned long nr_pages) } EXPORT_SYMBOL(free_contig_range); -/* - * The zone indicated has a new number of managed_pages; batch sizes and percpu - * page high values need to be recalculated. - */ -void zone_pcp_update(struct zone *zone, int cpu_online) -{ - mutex_lock(&pcp_batch_high_lock); - zone_set_pageset_high_and_batch(zone, cpu_online); - mutex_unlock(&pcp_batch_high_lock); -} - /* * Effectively disable pcplists for the zone by setting the high limit to 0 * and draining all cpus. A concurrent page freeing on another CPU that's about From patchwork Fri Sep 16 07:22:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978207 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 0DD48C6FA82 for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 513FE8D0001; Fri, 16 Sep 2022 03:23:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 34D5E8D0006; Fri, 16 Sep 2022 03:23:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23D7A8D0001; Fri, 16 Sep 2022 03:23:44 -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 016B08D0005 for ; Fri, 16 Sep 2022 03:23:43 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CEFC8161AE2 for ; Fri, 16 Sep 2022 07:23:43 +0000 (UTC) X-FDA: 79917108726.09.8B341A4 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf06.hostedemail.com (Postfix) with ESMTP id 292ED180092 for ; Fri, 16 Sep 2022 07:23:41 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQTd3xGsznVHr; Fri, 16 Sep 2022 15:20:53 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:36 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 03/16] mm: remove obsolete macro NR_PCP_ORDER_MASK and NR_PCP_ORDER_WIDTH Date: Fri, 16 Sep 2022 15:22:44 +0800 Message-ID: <20220916072257.9639-4-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313022; a=rsa-sha256; cv=none; b=eRzZwKLLzcAilA8QzDV4hFenzVsycLlrPvGorjrBqLSGRUMTjlQMDrDUYqnjnHiBlSNlQl dtyL9rxLbPZEFB26WKGKHylb9t/BjHwKEy1Om+aeQ3C9LeSFg/F/5fWVhVoKHniQgCboin L+qFqUJlXJE6AI7h7vZKpxFtnAiG+9I= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313022; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lQKdPK+vQYytREOd7Lx+FnRXWJ4ZTgDzBbWK9n9q8d8=; b=mcdvdz2mnMRp0vrT+3lgbWQSoCDetXZa4demg1DLJTBow8HquAEIPUpn05HjsmCSLgn0OJ qsPs6PJ+vgJOJ6+QceyI32YWUeG1vV7gjvieqINUOqutV3nObZG8pkD12Ix/0BwOKTUHsC WuXUAL8WadqOJk9r2d2ZA3ENFXCDdG0= X-Stat-Signature: rnam1xg5k7768uhxudt6nauqam1acuj1 X-Rspamd-Queue-Id: 292ED180092 Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam01 X-Rspam-User: X-HE-Tag: 1663313021-405509 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: Since commit 8b10b465d0e1 ("mm/page_alloc: free pages in a single pass during bulk free"), they're not used anymore. Remove them. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- include/linux/mmzone.h | 7 ------- mm/page_alloc.c | 1 - 2 files changed, 8 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d907a29cc429..93f9aa346724 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -564,13 +564,6 @@ enum zone_watermarks { #define NR_LOWORDER_PCP_LISTS (MIGRATE_PCPTYPES * (PAGE_ALLOC_COSTLY_ORDER + 1)) #define NR_PCP_LISTS (NR_LOWORDER_PCP_LISTS + NR_PCP_THP) -/* - * Shift to encode migratetype and order in the same integer, with order - * in the least significant bits. - */ -#define NR_PCP_ORDER_WIDTH 8 -#define NR_PCP_ORDER_MASK ((1<_watermark[WMARK_MIN] + z->watermark_boost) #define low_wmark_pages(z) (z->_watermark[WMARK_LOW] + z->watermark_boost) #define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 04559870ed12..bb2906829599 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1584,7 +1584,6 @@ static void free_pcppages_bulk(struct zone *zone, int count, order = pindex_to_order(pindex); nr_pages = 1 << order; - BUILD_BUG_ON(MAX_ORDER >= (1< X-Patchwork-Id: 12978215 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 E58EFECAAD8 for ; Fri, 16 Sep 2022 07:23:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C4A1C8000B; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B8C188000E; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9437D8000B; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 402428000B for ; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 296EEA0913 for ; Fri, 16 Sep 2022 07:23:47 +0000 (UTC) X-FDA: 79917108894.22.93BC464 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf07.hostedemail.com (Postfix) with ESMTP id EB76340098 for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MTQVP2NKvzBsQS; Fri, 16 Sep 2022 15:21:33 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:37 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 04/16] mm/page_alloc: remove obsolete comment in zone_statistics() Date: Fri, 16 Sep 2022 15:22:45 +0800 Message-ID: <20220916072257.9639-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=JSd0jj+IFP7se2KALCkS16Z/Sq5N7zB1m/GxqgSgmIQL7LJ5BhZME+BsIvoyzrfSd1ciJZ 8g9Hm2bBcBoeSAg0eG4ty2qwybabgZB3C7aUzDx9/88i4Xh8BPvSE64hyrMg3QThuYoXLi sDkd7kex2czNH+5r6rRkEuicnw/q23c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3f26WbjlAaR0Uqp0qQL6viL6p+3mNQsWvMbKRVD+Z2I=; b=R/fRQPagZFr0BNytm6XrUBz6KLxzm11cKSNHHzZM97nBLiKU/C+n/PPI7/AghTmUGYf1DQ Z3PIs/xgl7Rnz4aMkMYHLn9j/3g2VrXFTv8jGlsjNtgZ96l7m4OpwO7IoX96JmdhUl5dYI 4IPf8tf0Mq5K7awNFmWtzv+HdH8KU0c= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: EB76340098 Authentication-Results: imf07.hostedemail.com; dkim=none; spf=pass (imf07.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: mw795w5rg1n17yr35cn3mygq66w88zd3 X-HE-Tag: 1663313025-984409 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: Since commit 43c95bcc51e4 ("mm/page_alloc: reduce duration that IRQs are disabled for VM counters"), zone_statistics() is not called with interrupts disabled. Update the corresponding comment. Signed-off-by: Miaohe Lin Acked-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- mm/page_alloc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bb2906829599..762619463bb5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3671,8 +3671,6 @@ void __putback_isolated_page(struct page *page, unsigned int order, int mt) /* * Update NUMA hit/miss statistics - * - * Must be called with interrupts disabled. */ static inline void zone_statistics(struct zone *preferred_zone, struct zone *z, long nr_account) From patchwork Fri Sep 16 07:22:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978211 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 6BB87C6FA90 for ; Fri, 16 Sep 2022 07:23:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E31280007; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 019398000A; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAFE380007; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AB77F80009 for ; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7DD3941B0E for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) X-FDA: 79917108852.06.CA5F3EF Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf23.hostedemail.com (Postfix) with ESMTP id B01FF1400C7 for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MTQVP698TzBsQZ; Fri, 16 Sep 2022 15:21:33 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:37 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 05/16] mm/page_alloc: add __init annotations to init_mem_debugging_and_hardening() Date: Fri, 16 Sep 2022 15:22:46 +0800 Message-ID: <20220916072257.9639-6-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=08BRe/teEAvB0just4LQevI8tGACfpXF8osDunBBngc=; b=rw2ZFhFhtFjjlaOqEo8KAKMpE6NR1WC/iEPMHpfIG+BWgMKlAGm/OkT9U4ZDP+R1TRSy8q 2SeSY8H29+kBOenpMbhET/UUeUNG3+7j4pfQ4xyCve20vHDIlHBJ5L4gzfOJuwPy6qTJvC v4yNpZhtIOPRwyTucjpuMl6AL/rTBPY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=LudSmpbrF4WTJLtjlSJj+9877syN0eintJtjo93S/qUh2J/I3H1lgzJ7x+jUz6cLENIT5L aokBMbFGQvTkgtVJlE76N/wp56JYPHQOulaX1GduKCHq1KNFTGrafKabBXppruTvcQjq70 QIc0qCACUe9AcR+l1mOO2ifYG09OcN4= X-Stat-Signature: h7r9ofq69ozz7xcdsbsijrpnws8ow8m5 X-Rspamd-Queue-Id: B01FF1400C7 X-Rspam-User: Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam06 X-HE-Tag: 1663313025-625945 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: It's only called by mm_init(). Add __init annotations to it. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- include/linux/mm.h | 2 +- mm/page_alloc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 364bcadb4d20..c2277f5aba9e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3093,7 +3093,7 @@ extern int apply_to_existing_page_range(struct mm_struct *mm, unsigned long address, unsigned long size, pte_fn_t fn, void *data); -extern void init_mem_debugging_and_hardening(void); +extern void __init init_mem_debugging_and_hardening(void); #ifdef CONFIG_PAGE_POISONING extern void __kernel_poison_pages(struct page *page, int numpages); extern void __kernel_unpoison_pages(struct page *page, int numpages); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 762619463bb5..27ef763bb59f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -903,7 +903,7 @@ static inline void clear_page_guard(struct zone *zone, struct page *page, * order of appearance. So we need to first gather the full picture of what was * enabled, and then make decisions. */ -void init_mem_debugging_and_hardening(void) +void __init init_mem_debugging_and_hardening(void) { bool page_poisoning_requested = false; From patchwork Fri Sep 16 07:22:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978213 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 509E8ECAAD8 for ; Fri, 16 Sep 2022 07:23:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 743EE80009; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5874F8000E; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3273D8000D; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 13D6F8000B for ; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id CE9E314083D for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) X-FDA: 79917108852.02.8AAF678 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id 540281400D0 for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MTQRT18CRzMmx1; Fri, 16 Sep 2022 15:19:01 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:38 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 06/16] mm/page_alloc: fix freeing static percpu memory Date: Fri, 16 Sep 2022 15:22:47 +0800 Message-ID: <20220916072257.9639-7-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=eYm2Xdnmx5HdV0hF8JDVmG7DRz009aCoRWmfH9oYmCP+/CnzudU//yqYvqTvkAEgOQinyu wlLC8x/btX9Rn4jpOw9eRY0MNGEaRl8YsLbunasTFAuyjt/f/kA1uPd9UmGo7k3z4SMyOC c6mf4lPrbEcBlHwVo8pU43JGojsgu9E= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9PT+NFWr6n4hbOQN1nIg0F2Tcs95ZMNXMHfuFj4JHrM=; b=aOBgyEjjh6Rtur/UNR64K4azat8yoyYTK2ngrBniZ77PVDNPeW0/NIkr7WNWXXRs6nVXry m4rMmNGzp5NMEmARB/lbn3L07Qz/ISmW/SY3u0V46I83gqyzwyJKwKJzaEdv3x6C0chk87 adBBSe2wIlBziSGQjsjIe0PrKVaqc5c= X-Stat-Signature: g1kjbjye359qn7jb47htif5p3x5zrhy7 X-Rspamd-Queue-Id: 540281400D0 Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam01 X-Rspam-User: X-HE-Tag: 1663313026-203864 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 size of struct per_cpu_zonestat can be 0 on !SMP && !NUMA. In that case, zone->per_cpu_zonestats will always equal to boot_zonestats. But in zone_pcp_reset(), zone->per_cpu_zonestats is freed via free_percpu() directly without checking against boot_zonestats first. boot_zonestats will be released by free_percpu() unexpectedly. Fixes: 28f836b6777b ("mm/page_alloc: split per cpu page lists and zone stats") Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador --- mm/page_alloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 27ef763bb59f..cad235770948 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -9505,9 +9505,11 @@ void zone_pcp_reset(struct zone *zone) drain_zonestat(zone, pzstats); } free_percpu(zone->per_cpu_pageset); - free_percpu(zone->per_cpu_zonestats); zone->per_cpu_pageset = &boot_pageset; - zone->per_cpu_zonestats = &boot_zonestats; + if (zone->per_cpu_zonestats != &boot_zonestats) { + free_percpu(zone->per_cpu_zonestats); + zone->per_cpu_zonestats = &boot_zonestats; + } } } From patchwork Fri Sep 16 07:22:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978208 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 C6B34C6FA90 for ; Fri, 16 Sep 2022 07:23:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3299D8D0006; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D89C8D0003; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 179438D0006; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 072B38D0003 for ; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CAE37AC621 for ; Fri, 16 Sep 2022 07:23:44 +0000 (UTC) X-FDA: 79917108768.02.492C1EA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf29.hostedemail.com (Postfix) with ESMTP id 3A7941200EA for ; Fri, 16 Sep 2022 07:23:44 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQTg4fQ1znVKN; Fri, 16 Sep 2022 15:20:55 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:38 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 07/16] mm: remove obsolete pgdat_is_empty() Date: Fri, 16 Sep 2022 15:22:48 +0800 Message-ID: <20220916072257.9639-8-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313024; a=rsa-sha256; cv=none; b=iPSm76ZF8LXl7d3S3h5gvXTcVc7lSEPi3xnfgTUGePeWVJBdLVJbpo/kfCQeSlEJXGnXgx odonSQvkieZhBGR5o05B6WQ7q/Ku/af9TXMMVrZK4+3nKfNclpnbI4hNMeeREi3/g5L3EC w0rTqSTxp9EePVPfYiPxfyOAwLgA600= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313024; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LCeuBiq9PirRyT0jP1Cr7DeE6R03m8NEcLFqkB3RNxg=; b=ID80TKUey/nUzcvoT58fR5h5a114pjV8XQsET1m7/cGbgd8VZSK0WACWBcfBWKirweR3Bd GoN6Aiux6NBW1AWOAitP95k79dziTil9q9A2jYrQpftfm3nSJFoRQJaYnPgliF4ivlBYkg St3MLo70urkx/dhD8ma0SZD24HB8m3w= X-Rspamd-Queue-Id: 3A7941200EA X-Rspam-User: Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: sty9eb6iosojwbs6wbrtbputynxufuzn X-Rspamd-Server: rspam04 X-HE-Tag: 1663313024-306798 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: There's no caller. Remove it. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- include/linux/mmzone.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 93f9aa346724..2b3f273faf68 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1241,11 +1241,6 @@ static inline unsigned long pgdat_end_pfn(pg_data_t *pgdat) return pgdat->node_start_pfn + pgdat->node_spanned_pages; } -static inline bool pgdat_is_empty(pg_data_t *pgdat) -{ - return !pgdat->node_start_pfn && !pgdat->node_spanned_pages; -} - #include void build_all_zonelists(pg_data_t *pgdat); From patchwork Fri Sep 16 07:22:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978209 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 5EF63ECAAD8 for ; Fri, 16 Sep 2022 07:23:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 85B388D0003; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 808CD8D0007; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65ACF8D0003; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 50AE18D0007 for ; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 28731161ACB for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) X-FDA: 79917108810.08.7DDCB51 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id 7A46C200B1 for ; Fri, 16 Sep 2022 07:23:44 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSC111QzlW04; Fri, 16 Sep 2022 15:19:39 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:39 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 08/16] mm/page_alloc: add missing is_migrate_isolate() check in set_page_guard() Date: Fri, 16 Sep 2022 15:22:49 +0800 Message-ID: <20220916072257.9639-9-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313024; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eTHkjzvxkq+wgCSfHi6Ff5LmrUqxvT8wa3rEmWdy5e8=; b=Y6+oz9FC+il0RieyntHP7hR0ugUFLiHMjpTomF1o1tEDLv+7jWbY+xu9ax+eTCEerFT1ly q8ACUEyWv22B9pgHz4uQWgFkJghqEgLHnSJua6T0fCC1Fv0MhU3EWIY8Mz8PE2EiRRyMI5 YFl1mFk9jxz5lIY0CbI5nFvIPVJmFC8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313024; a=rsa-sha256; cv=none; b=Sa+B/AZUi9qts4xgN9rillfvKVK7O5AKREKUTH9PalMGiwFG2gWFCV7wVnemlhV8Fb9SSD NicyWcfZ4vls+hqNTqqFIjwf6GxtxbmzjDa7gfr4c8dvJMvEv8bEna2A4jK4Wpm/nphvs2 P8ndeUEv5WfuGm0z4v3suuqa+Py0+PE= X-Stat-Signature: 5gjyshtxzf1nsc7p6zbgk3z7erxof9q6 X-Rspamd-Queue-Id: 7A46C200B1 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam06 X-HE-Tag: 1663313024-56083 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: In MIGRATE_ISOLATE case, zone freepage state shouldn't be modified as caller will take care of it. Add missing is_migrate_isolate() here to avoid possible unbalanced freepage state. This would happen if someone isolates the block, and then we face an MCE failure/soft-offline on a page within that block. __mod_zone_freepage_state() will be triggered via below call trace which already had been triggered back when block was isolated: take_page_off_buddy break_down_buddy_pages set_page_guard Fixes: 06be6ff3d2ec ("mm,hwpoison: rework soft offline for free pages") Signed-off-by: Miaohe Lin Reviewed-by: Oscar Salvador Reviewed-by: David Hildenbrand --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cad235770948..8fcc905ef317 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -873,7 +873,8 @@ static inline bool set_page_guard(struct zone *zone, struct page *page, INIT_LIST_HEAD(&page->buddy_list); set_page_private(page, order); /* Guard pages are not available for any usage */ - __mod_zone_freepage_state(zone, -(1 << order), migratetype); + if (!is_migrate_isolate(migratetype)) + __mod_zone_freepage_state(zone, -(1 << order), migratetype); return true; } From patchwork Fri Sep 16 07:22:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978220 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 52E3CECAAD8 for ; Fri, 16 Sep 2022 07:24:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A324880012; Fri, 16 Sep 2022 03:23:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 972CD80010; Fri, 16 Sep 2022 03:23:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8344780012; Fri, 16 Sep 2022 03:23:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6D6D280010 for ; Fri, 16 Sep 2022 03:23:52 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 516EE40247 for ; Fri, 16 Sep 2022 07:23:52 +0000 (UTC) X-FDA: 79917109104.15.2C5A391 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf15.hostedemail.com (Postfix) with ESMTP id C01F0A00A6 for ; Fri, 16 Sep 2022 07:23:51 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MTQVR6z8RzBsQb; Fri, 16 Sep 2022 15:21:35 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:39 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 09/16] mm/page_alloc: use local variable zone_idx directly Date: Fri, 16 Sep 2022 15:22:50 +0800 Message-ID: <20220916072257.9639-10-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313032; a=rsa-sha256; cv=none; b=7VBBvghQmQAHnZiSqtNHVhAFvrDr1jvBHmU8qkEQaTdMCgnmexgMbygebwOHLYcxEEqiwM p60bDLDtF0itcffwhUOexojOO/2tUfA70Wu8UVY333afLDU2owXujMmCQ3g0FVE5A26o7P CsCMRzh3ypMaOQ5j5havRU7KJE5s9aU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313032; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QBth5j6IuYHEhfYUErWRhFgbNxXlCBJDRrL6UhXfT+U=; b=Voy42xGy4g6P1rMFXuixnu/8rbzrfjVNr89sqq+JLMMZHfI970Eat5A/LYm2yb0baLdZtR AT1hhPrZJxs2bCbMzf8a1BRt84VbTYih6/mQMz+/BdbN1o5O8eqvrYWVShTQ6zZbrwipgW LTB/4N/z6h7dxUMkBTFcLvaRgt5FVpI= Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C01F0A00A6 X-Stat-Signature: nhdpkkq85bre57t5o5rz5c511tiqpc38 X-Rspam-User: X-HE-Tag: 1663313031-646740 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: Use local variable zone_idx directly since it holds the exact value of zone_idx(). No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- 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 8fcc905ef317..83b2cb93d6fd 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6873,7 +6873,7 @@ void __ref memmap_init_zone_device(struct zone *zone, unsigned long start = jiffies; int nid = pgdat->node_id; - if (WARN_ON_ONCE(!pgmap || zone_idx(zone) != ZONE_DEVICE)) + if (WARN_ON_ONCE(!pgmap || zone_idx != ZONE_DEVICE)) return; /* From patchwork Fri Sep 16 07:22:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978210 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 03235C54EE9 for ; Fri, 16 Sep 2022 07:23:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8A96B80008; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82F9180007; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71F4D80008; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6235780007 for ; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 42679141A94 for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) X-FDA: 79917108852.18.A5C0FFE Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf20.hostedemail.com (Postfix) with ESMTP id A0FA81C00C3 for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSD1RYCzlW09; Fri, 16 Sep 2022 15:19:40 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:40 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 10/16] mm, memory_hotplug: remove obsolete generic_free_nodedata() Date: Fri, 16 Sep 2022 15:22:51 +0800 Message-ID: <20220916072257.9639-11-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=QEhsH4vl+WmRvqE/TYW9pV55nHSHhzpJ+6HExyyzpzgAp0wJyeUsSX1BJuaw4BPvLenSqE 03RpbFV2wIytD4YVK/Ufi8+2dKNpVrkqUWPe7c8fAqv6EsdOltzzcGLp/xT81B/ppzlvLf AvGl1PegE2SOuUepUTRIwA6maLnnvl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IHFoWOX7Km2ZEJnziw0u5f8v+dEK8n3bdbtAKi1mOzQ=; b=tcQ7A8Z/Zf+44j1P7dYm+qygTFvG/DKdp+743hhyjFL//tIqor0PlDuVvMqCfT+cEwkZ6/ hld0tK/HWlcwym0CjwjebRD1txQGWhUNPMRt5IUFDJi9zAzGiyvtrBkHlhSb+NJfF1ITFT Ds2HrJsBmNKRBr93kGV06HD0YhpCLBM= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: A0FA81C00C3 Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: oj3m5r8a4em8izuj8519yqxkkgd36uoh X-HE-Tag: 1663313025-763833 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: Commit 390511e1476e ("mm, memory_hotplug: drop arch_free_nodedata") drops the last caller of generic_free_nodedata(). Remove it too. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- include/linux/memory_hotplug.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 51052969dbfe..9fcbf5706595 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -43,11 +43,6 @@ extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat); ({ \ memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES); \ }) -/* - * This definition is just for error path in node hotadd. - * For node hotremove, we have to replace this. - */ -#define generic_free_nodedata(pgdat) kfree(pgdat) extern pg_data_t *node_data[]; static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) @@ -63,9 +58,6 @@ static inline pg_data_t *generic_alloc_nodedata(int nid) BUG(); return NULL; } -static inline void generic_free_nodedata(pg_data_t *pgdat) -{ -} static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) { } From patchwork Fri Sep 16 07:22:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978212 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 D6C2AC6FA82 for ; Fri, 16 Sep 2022 07:23:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E8E88000A; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17D378000C; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4CF980009; Fri, 16 Sep 2022 03:23:46 -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 B89C68000A for ; Fri, 16 Sep 2022 03:23:46 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9BC5FA0913 for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) X-FDA: 79917108852.20.99FDEEA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf17.hostedemail.com (Postfix) with ESMTP id 3FFC8400A0 for ; Fri, 16 Sep 2022 07:23:44 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSD5C5ZzlVkV; Fri, 16 Sep 2022 15:19:40 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:40 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 11/16] mm/page_alloc: make boot_nodestats static Date: Fri, 16 Sep 2022 15:22:52 +0800 Message-ID: <20220916072257.9639-12-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iK8BMsXwXMayWAIvxsgBQTmQW4Ixe9oaf4wGNyU2anU=; b=yR5ag1FiJub0WShk3T2dWLmuAdI3rHA3NGEnMN7LwoK2aMoAA/QEzEdYOXc1fX5AgVaBa/ fZjwHtqO29FHFnQ9JsCXd1FevEp9MVhFTYsFfWZwCtp2bxXLLQ39Wuv6X8moK4ec77w+23 XpTQ32IuHu2LI1fgqWM0O9Y29h6pQmI= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=KjOWRIF64dQR6QN601HNUQJTE7qcGWEIh/VYJWtYeylKFHptSHrLyDe7eU0JV4JV0nUVE3 Tr+Mu4got9qh9tdEp/dvG8vNTIUVfYCzHR6cxnzb0W34yBcioDjWhHSi9Vxh8rocrxiEsZ 8oTwNfNKh6icA9MNmXmzUhgWFAzhoXY= Authentication-Results: imf17.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf17.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: 6k4qwy8cqa3ge4cmdub779s6g4fziwqr X-Rspamd-Queue-Id: 3FFC8400A0 X-Rspamd-Server: rspam12 X-Rspam-User: X-HE-Tag: 1663313024-844549 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: It's only used in mm/page_alloc.c now. Make it static. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- mm/internal.h | 2 -- mm/page_alloc.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/internal.h b/mm/internal.h index 94d8a976c2e2..b3002e03c28f 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -836,8 +836,6 @@ int migrate_device_coherent_page(struct page *page); */ struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags); -DECLARE_PER_CPU(struct per_cpu_nodestat, boot_nodestats); - extern bool mirrored_kernelcore; static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 83b2cb93d6fd..6bdc98c7019f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6571,7 +6571,7 @@ static void per_cpu_pages_init(struct per_cpu_pages *pcp, struct per_cpu_zonesta #define BOOT_PAGESET_BATCH 1 static DEFINE_PER_CPU(struct per_cpu_pages, boot_pageset); static DEFINE_PER_CPU(struct per_cpu_zonestat, boot_zonestats); -DEFINE_PER_CPU(struct per_cpu_nodestat, boot_nodestats); +static DEFINE_PER_CPU(struct per_cpu_nodestat, boot_nodestats); static void __build_all_zonelists(void *data) { From patchwork Fri Sep 16 07:22:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978217 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 6C303C6FA90 for ; Fri, 16 Sep 2022 07:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BE988000E; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76D0C8000C; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 524DA80010; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3902A8000E for ; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0DCA7AC620 for ; Fri, 16 Sep 2022 07:23:48 +0000 (UTC) X-FDA: 79917108936.23.3213C9E Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf28.hostedemail.com (Postfix) with ESMTP id CBC56C00CD for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MTQVT4H5LzBsQh; Fri, 16 Sep 2022 15:21:37 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:41 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 12/16] mm/page_alloc: use helper macro SZ_1{K,M} Date: Fri, 16 Sep 2022 15:22:53 +0800 Message-ID: <20220916072257.9639-13-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313027; a=rsa-sha256; cv=none; b=BJUE70H/VPPPGFMqxWBEmCiTwSGjWMMDuCZJuhkHXTVXL52ZVYl0u1CjR/nSE9C5x77uiw 96yCKYT2ndWIPezA9k0SD6lUeRHzQqGPrN+deyT/6vl6JYkmFdxBrldOR+6t5HCkPlvzmQ a/ZRhprtm0/OH0sRUff8Zsu31wO2ZAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313027; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VoRicsi7p/LDEWr9E2zFhGeztwX6q2BBM6g94oHJvVc=; b=hcmijf2DsucR/hRbcO9RFOtNqADiWcm8AY1NO9pucZHNQtpFv39a01yzikRXy/wc/Msc0Q /vb7AcR/++N/ZvzEitKeLH5nXuZ1Bj+72iomEt85eYMjkfg2gxE9TvZuwOMzYN7yRVII3/ yViLQblROzzuTfMx2b3UW0fQBnWfb2Q= Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CBC56C00CD X-Stat-Signature: mug7q4t6d66bana3jpxmw81wy8tu7rcg X-Rspam-User: X-HE-Tag: 1663313026-417743 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: Use helper macro SZ_1K and SZ_1M to do the size conversion. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand --- mm/page_alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6bdc98c7019f..67ec8a2e1db2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7048,7 +7048,7 @@ static int zone_batchsize(struct zone *zone) * size is striking a balance between allocation latency * and zone lock contention. */ - batch = min(zone_managed_pages(zone) >> 10, (1024 * 1024) / PAGE_SIZE); + batch = min(zone_managed_pages(zone) >> 10, SZ_1M / PAGE_SIZE); batch /= 4; /* We effectively *= 4 below */ if (batch < 1) batch = 1; @@ -8523,8 +8523,8 @@ void __init mem_init_print_info(void) #endif ")\n", K(nr_free_pages()), K(physpages), - codesize >> 10, datasize >> 10, rosize >> 10, - (init_data_size + init_code_size) >> 10, bss_size >> 10, + codesize / SZ_1K, datasize / SZ_1K, rosize / SZ_1K, + (init_data_size + init_code_size) / SZ_1K, bss_size / SZ_1K, K(physpages - totalram_pages() - totalcma_pages), K(totalcma_pages) #ifdef CONFIG_HIGHMEM @@ -9049,8 +9049,8 @@ void *__init alloc_large_system_hash(const char *tablename, numentries -= arch_reserved_kernel_pages(); /* It isn't necessary when PAGE_SIZE >= 1MB */ - if (PAGE_SHIFT < 20) - numentries = round_up(numentries, (1<<20)/PAGE_SIZE); + if (PAGE_SIZE < SZ_1M) + numentries = round_up(numentries, SZ_1M / PAGE_SIZE); #if __BITS_PER_LONG > 32 if (!high_limit) { From patchwork Fri Sep 16 07:22:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978214 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 A66B9C54EE9 for ; Fri, 16 Sep 2022 07:23:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DBD98000D; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C3B38000C; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 684028000D; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1EE8180009 for ; Fri, 16 Sep 2022 03:23:47 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 00B32AC634 for ; Fri, 16 Sep 2022 07:23:47 +0000 (UTC) X-FDA: 79917108894.12.135AB52 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 9CF141000AF for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSG0DwrzlVhh; Fri, 16 Sep 2022 15:19:42 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:41 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 13/16] mm/page_alloc: init local variable buddy_pfn Date: Fri, 16 Sep 2022 15:22:54 +0800 Message-ID: <20220916072257.9639-14-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313026; a=rsa-sha256; cv=none; b=JPs3vHtHbNFebvfFXLRXvZTgv7pyUODxRT8Jj6vv9YKZx4VmvblGcKGj7E1OL+4UbWwl7A 5Mi8sDgi5D9XpOkurhuKdbQ5pB4Wy3M40x2vQghoJS7qpxN8mKsfBZcnRqugbxvy8+2nrs J96LDIeX3KzjZ7JLT6/dfrPjBkzp1lA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313026; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QNF1FU2AkhLK6sqO5FOxUtr8IXW6zKvUSQIsR1Q9c0I=; b=UR0KYAPrl/W/KqdtrQSfJwNffKbq8hM+B+8+cxmlicpqkfALk93j8auYLde7I22p8VW+4K mgUw8ZJ+4tH28RCQTm8DNQPR3uHRivV/9riyAPKJq3hv2KUL64dRauu/GWvLlwqZ8xVUqx fXGWs4kEYoSz6pJOsyBd9XWHkovbPoI= X-Rspamd-Queue-Id: 9CF141000AF X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: w4h1p97wsrwy147mm9jmb5xkurndo8oc X-Rspamd-Server: rspam04 X-HE-Tag: 1663313025-822667 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 local variable buddy_pfn could be passed to buddy_merge_likely() without initialization if the passed in order is MAX_ORDER - 1. This looks buggy but buddy_pfn won't be used in this case as there's a order >= MAX_ORDER - 2 check. Init buddy_pfn to 0 anyway to avoid possible future misuse. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- 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 67ec8a2e1db2..652b3d766003 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1113,7 +1113,7 @@ static inline void __free_one_page(struct page *page, int migratetype, fpi_t fpi_flags) { struct capture_control *capc = task_capc(zone); - unsigned long buddy_pfn; + unsigned long buddy_pfn = 0; unsigned long combined_pfn; struct page *buddy; bool to_tail; From patchwork Fri Sep 16 07:22:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978219 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 08B9DC6FA82 for ; Fri, 16 Sep 2022 07:24:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB49F80011; Fri, 16 Sep 2022 03:23:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B669E80010; Fri, 16 Sep 2022 03:23:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 943D780011; Fri, 16 Sep 2022 03:23:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8125C80010 for ; Fri, 16 Sep 2022 03:23:49 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 63ED3161AE2 for ; Fri, 16 Sep 2022 07:23:49 +0000 (UTC) X-FDA: 79917108978.08.D95FAE9 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf06.hostedemail.com (Postfix) with ESMTP id D0A2A180092 for ; Fri, 16 Sep 2022 07:23:48 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSG40s2zlVyw; Fri, 16 Sep 2022 15:19:42 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:42 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 14/16] mm/page_alloc: use costly_order in WARN_ON_ONCE_GFP() Date: Fri, 16 Sep 2022 15:22:55 +0800 Message-ID: <20220916072257.9639-15-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313029; a=rsa-sha256; cv=none; b=jXy8Mtc+jhKRjeOPGpe13EykcmhDQJ+cTFPRSvhw560YpVuTGfsfbYPJ2l5dTkkDjv3dMM GSahfvxcktU6RS5tDNdq0Ks1GPRfX5QGzhNLAyZXLp+bkbNK+iObTmcR5AQffZnEEPUgbR 3+naL2ybPLO7GZEd0H94FEOcvba50ZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313029; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GuG/aQGBzQUlR14SnEuumxij3zFNtwkrffWWQU2Os0c=; b=vFXPC6THTzK51rxlFvenxDe27bnAvALmeG6nc+Q68BieAE3BYAINnxMkek8kOS4gz47M5a tPDrbzRAXqmIakf9uGJPvnwgQFG9xN1sRACT3+NIqeBPpHsgztmOh2QHUGMc8Q96T1PlnO GgvQcCeIWeP9ss4IAXsFKkZkmR+/6fw= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: D0A2A180092 Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: hos4z1jozdcwkwkrfuzuxqiehnqoa5jh X-HE-Tag: 1663313028-983308 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: There's no need to check whether order > PAGE_ALLOC_COSTLY_ORDER again. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- 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 652b3d766003..3d2ad5c197d5 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5272,7 +5272,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, * so that we can identify them and convert them to something * else. */ - WARN_ON_ONCE_GFP(order > PAGE_ALLOC_COSTLY_ORDER, gfp_mask); + WARN_ON_ONCE_GFP(costly_order, gfp_mask); /* * Help non-failing allocations by giving them access to memory From patchwork Fri Sep 16 07:22:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978216 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 3EF05C6FA82 for ; Fri, 16 Sep 2022 07:24:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 441DD8000F; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 376558000C; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 153018000E; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 04EEA8000C for ; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D7CDEA1AC4 for ; Fri, 16 Sep 2022 07:23:47 +0000 (UTC) X-FDA: 79917108894.21.C57E681 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf03.hostedemail.com (Postfix) with ESMTP id 3A478200A1 for ; Fri, 16 Sep 2022 07:23:47 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQTm0zvKznVKV; Fri, 16 Sep 2022 15:21:00 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:43 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 15/16] mm/page_alloc: remove obsolete gfpflags_normal_context() Date: Fri, 16 Sep 2022 15:22:56 +0800 Message-ID: <20220916072257.9639-16-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313027; a=rsa-sha256; cv=none; b=lmSKgLMpcpwan0/HbkwylMcKzl7jBSNzA88+hsrWfiW31I/0WSBEB0RwuaBkUu3rNKSbJj o3QSsHuxFO33Qii2gOUWhvSWV8kNFE1dQ8mPe1KqPlNijHRcb6sqfGz7nphbb+r2yw+Hg/ MNAA/ZxoyPmOC/soSSW8C4UTSFc7j58= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313027; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MEfrSEwsjO2e2CQ+DkhsO/Tn5RXErYne1/maYe3hAVQ=; b=OrY8Ps9zlaM+Evkgz9helDzWZBRqDlyGJRDTZ1BPZsXYzMoerGhT7AfxhupGc55eCxaIHw gDYm3K+J3EOn9tKuCg5F6LXpuIVtKkW6VeY4wdvTriSH3KDHW9MBOC9TNDqG9gSYaMSaww nFXhWHXW7+2M1GYIOIfGYr6rHISYH78= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 3A478200A1 Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: dm3hkn8ags1xwtcauw3z16g56nepuoxy X-HE-Tag: 1663313027-155668 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: Since commit dacb5d8875cc ("tcp: fix page frag corruption on page fault"), there's no caller of gfpflags_normal_context(). Remove it as this helper is strictly tied to the sk page frag usage and there won't be other user in the future. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- include/linux/gfp.h | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index ea6cb9399152..ef4aea3b356e 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -36,29 +36,6 @@ static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags) return !!(gfp_flags & __GFP_DIRECT_RECLAIM); } -/** - * gfpflags_normal_context - is gfp_flags a normal sleepable context? - * @gfp_flags: gfp_flags to test - * - * Test whether @gfp_flags indicates that the allocation is from the - * %current context and allowed to sleep. - * - * An allocation being allowed to block doesn't mean it owns the %current - * context. When direct reclaim path tries to allocate memory, the - * allocation context is nested inside whatever %current was doing at the - * time of the original allocation. The nested allocation may be allowed - * to block but modifying anything %current owns can corrupt the outer - * context's expectations. - * - * %true result from this function indicates that the allocation context - * can sleep and use anything that's associated with %current. - */ -static inline bool gfpflags_normal_context(const gfp_t gfp_flags) -{ - return (gfp_flags & (__GFP_DIRECT_RECLAIM | __GFP_MEMALLOC)) == - __GFP_DIRECT_RECLAIM; -} - #ifdef CONFIG_HIGHMEM #define OPT_ZONE_HIGHMEM ZONE_HIGHMEM #else From patchwork Fri Sep 16 07:22:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978218 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 AD0E6ECAAD8 for ; Fri, 16 Sep 2022 07:24:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D63008000C; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C9C4E80010; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B43A28000C; Fri, 16 Sep 2022 03:23:48 -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 931C780010 for ; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 669021C04E1 for ; Fri, 16 Sep 2022 07:23:48 +0000 (UTC) X-FDA: 79917108936.05.3E2754A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf06.hostedemail.com (Postfix) with ESMTP id D2949180097 for ; Fri, 16 Sep 2022 07:23:47 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MTQSY1KpqzmVRN; Fri, 16 Sep 2022 15:19:57 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:43 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 16/16] mm/page_alloc: fix obsolete comment in deferred_pfn_valid() Date: Fri, 16 Sep 2022 15:22:57 +0800 Message-ID: <20220916072257.9639-17-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313028; a=rsa-sha256; cv=none; b=2U4g9SobWfDgeNaF/Kf/8h4PZN3MoQVo3z86DrJAW+jkUM28DGiAtCFkM3mhWWxBnFXdsn zXW8iQFNfbNBWi97losyAvI6uNXnugmYc+HcRUvQchg4aCJBO58KbdSl03U0lVoBsStWR5 FnsHvRxEFHCJjkRZMJ8hSdcm8Nr4jok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313028; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v6Xz9kNS+WFcTfnJhneyxsRLUQ4Ow+Q33pLtV4SNako=; b=S4ZP01+w55fS51SI0sQKEoQWNFZt0FcVIUzDGPmTkXEdDaBPYVOchkvRpqcr0ypjtVTFeK 1a3Xq9ml79HR9Huw5ZAxDh77u2lTGvwcI6149nJwUgWkxJySkwjJmYTG/S6ERi1tAwrc0u mThxhDD6fCGw01neqBmVNnEXLaYXqHo= X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D2949180097 Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: rh8zweeoeg1twsskr6faikpecgpw3yn9 X-HE-Tag: 1663313027-695573 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: There are no architectures that can have holes in the memory map within a pageblock since commit 859a85ddf90e ("mm: remove pfn_valid_within() and CONFIG_HOLES_IN_ZONE"). Update the corresponding comment. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand Reviewed-by: Anshuman Khandual Reviewed-by: Oscar Salvador --- mm/page_alloc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3d2ad5c197d5..d7b20bf09c1c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1929,11 +1929,7 @@ static inline void __init pgdat_init_report_one_done(void) /* * Returns true if page needs to be initialized or freed to buddy allocator. * - * First we check if pfn is valid on architectures where it is possible to have - * holes within pageblock_nr_pages. On systems where it is not possible, this - * function is optimized out. - * - * Then, we check if a current large page is valid by only checking the validity + * We check if a current large page is valid by only checking the validity * of the head pfn. */ static inline bool __init deferred_pfn_valid(unsigned long pfn)