From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FEB9C433FE for ; Wed, 8 Sep 2021 02:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 509FB6113C for ; Wed, 8 Sep 2021 02:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347421AbhIHC4M (ORCPT ); Tue, 7 Sep 2021 22:56:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:52394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347363AbhIHC4I (ORCPT ); Tue, 7 Sep 2021 22:56:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AEDDE61101; Wed, 8 Sep 2021 02:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1631069701; bh=fUew40qj/8w4/AzPxfELH062qu0GY66FEfx5GfWLGXk=; h=Date:From:To:Subject:In-Reply-To:From; b=GO37iwyFKwwRJkO/QJ0/BZq1sUPxd1S3MIUuqzyng/Znm4cJvrswrErpto7jws2Te EgrU9q1qGq0XNpXJ+tT4ubZq4c2/KHk5JlcWLlmXSMGxGs7xMRjORsw2pmG/Uqqq9v n/V9VFmSUwPqCh13D+iPB3YvkHRVSo6pJHG/Hyjk= Date: Tue, 07 Sep 2021 19:54:59 -0700 From: Andrew Morton To: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, anshuman.khandual@arm.com, anton@ozlabs.org, ardb@kernel.org, bauerman@linux.ibm.com, benh@kernel.crashing.org, bhe@redhat.com, borntraeger@de.ibm.com, bp@alien8.de, catalin.marinas@arm.com, cheloha@linux.ibm.com, christophe.leroy@c-s.fr, dalias@libc.org, dan.j.williams@intel.com, dave.hansen@linux.intel.com, dave.jiang@intel.com, david@redhat.com, gor@linux.ibm.com, hca@linux.ibm.com, hpa@zytor.com, jasowang@redhat.com, joe@perches.com, justin.he@arm.com, ldufour@linux.ibm.com, lenb@kernel.org, linux-mm@kvack.org, luto@kernel.org, mhocko@kernel.org, michel@lespinasse.org, mingo@redhat.com, mm-commits@vger.kernel.org, mpe@ellerman.id.au, mst@redhat.com, nathanl@linux.ibm.com, npiggin@gmail.com, osalvador@suse.de, pankaj.gupta.linux@gmail.com, pankaj.gupta@ionos.com, pasha.tatashin@soleen.com, paulus@samba.org, peterz@infradead.org, pmorel@linux.ibm.com, rafael.j.wysocki@intel.com, richard.weiyang@linux.alibaba.com, rjw@rjwysocki.net, rppt@kernel.org, slyfox@gentoo.org, songmuchun@bytedance.com, stable@vger.kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, vbabka@suse.cz, vishal.l.verma@intel.com, vkuznets@redhat.com, wangkefeng.wang@huawei.com, will@kernel.org, ysato@users.sourceforge.jp Subject: [patch 038/147] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() Message-ID: <20210908025459.6ns0U_Ngx%akpm@linux-foundation.org> In-Reply-To: <20210907195226.14b1d22a07c085b22968b933@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org From: David Hildenbrand Subject: mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() Patch series "mm/memory_hotplug: preparatory patches for new online policy and memory" These are all cleanups and one fix previously sent as part of [1]: [PATCH v1 00/12] mm/memory_hotplug: "auto-movable" online policy and memory groups. These patches make sense even without the other series, therefore I pulled them out to make the other series easier to digest. [1] https://lkml.kernel.org/r/20210607195430.48228-1-david@redhat.com This patch (of 4): Checkpatch complained on a follow-up patch that we are using "unsigned" here, which defaults to "unsigned int" and checkpatch is correct. As we will search for a fitting zone using the wrong pfn, we might end up onlining memory to one of the special kernel zones, such as ZONE_DMA, which can end badly as the onlined memory does not satisfy properties of these zones. Use "unsigned long" instead, just as we do in other places when handling PFNs. This can bite us once we have physical addresses in the range of multiple TB. Link: https://lkml.kernel.org/r/20210712124052.26491-2-david@redhat.com Fixes: e5e689302633 ("mm, memory_hotplug: display allowed zones in the preferred ordering") Signed-off-by: David Hildenbrand Reviewed-by: Pankaj Gupta Reviewed-by: Muchun Song Reviewed-by: Oscar Salvador Cc: David Hildenbrand Cc: Vitaly Kuznetsov Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Pankaj Gupta Cc: Wei Yang Cc: Michal Hocko Cc: Dan Williams Cc: Anshuman Khandual Cc: Dave Hansen Cc: Vlastimil Babka Cc: Mike Rapoport Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Pavel Tatashin Cc: Heiko Carstens Cc: Michael Ellerman Cc: Catalin Marinas Cc: virtualization@lists.linux-foundation.org Cc: Andy Lutomirski Cc: "Aneesh Kumar K.V" Cc: Anton Blanchard Cc: Ard Biesheuvel Cc: Baoquan He Cc: Benjamin Herrenschmidt Cc: Borislav Petkov Cc: Christian Borntraeger Cc: Christophe Leroy Cc: Dave Jiang Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Jia He Cc: Joe Perches Cc: Kefeng Wang Cc: Laurent Dufour Cc: Michel Lespinasse Cc: Nathan Lynch Cc: Nicholas Piggin Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Pierre Morel Cc: "Rafael J. Wysocki" Cc: Rich Felker Cc: Scott Cheloha Cc: Sergei Trofimovich Cc: Thiago Jung Bauermann Cc: Thomas Gleixner Cc: Vasily Gorbik Cc: Vishal Verma Cc: Will Deacon Cc: Yoshinori Sato Cc: Signed-off-by: Andrew Morton --- include/linux/memory_hotplug.h | 4 ++-- mm/memory_hotplug.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/linux/memory_hotplug.h~mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range +++ a/include/linux/memory_hotplug.h @@ -339,8 +339,8 @@ extern void sparse_remove_section(struct unsigned long map_offset, struct vmem_altmap *altmap); extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pnum); -extern struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, - unsigned long nr_pages); +extern struct zone *zone_for_pfn_range(int online_type, int nid, + unsigned long start_pfn, unsigned long nr_pages); extern int arch_create_linear_mapping(int nid, u64 start, u64 size, struct mhp_params *params); void arch_remove_linear_mapping(u64 start, u64 size); --- a/mm/memory_hotplug.c~mm-memory_hotplug-use-unsigned-long-for-pfn-in-zone_for_pfn_range +++ a/mm/memory_hotplug.c @@ -708,8 +708,8 @@ static inline struct zone *default_zone_ return movable_node_enabled ? movable_zone : kernel_zone; } -struct zone *zone_for_pfn_range(int online_type, int nid, unsigned start_pfn, - unsigned long nr_pages) +struct zone *zone_for_pfn_range(int online_type, int nid, + unsigned long start_pfn, unsigned long nr_pages) { if (online_type == MMOP_ONLINE_KERNEL) return default_kernel_zone_for_pfn(nid, start_pfn, nr_pages); _