Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1975942pxb; Thu, 16 Sep 2021 22:08:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYHzKGAxmxKsEAcd4aZnOiLe/zP+8J5WcwpRs8Qmbk3Gc+cm10vLoqinq7BeJIvBt4tcAx X-Received: by 2002:a17:906:7250:: with SMTP id n16mr10036636ejk.147.1631855328225; Thu, 16 Sep 2021 22:08:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631855328; cv=none; d=google.com; s=arc-20160816; b=1I/7EjiAX/kC0uPzTsDqbngeWlEynNDwgcZALK2MW6OTy3hBG1Wro8z1M02CwMLhew oUmkdRrgcp6s5KzUjFeif4RsgIziCuKJEz74SPQjII6p4RjWLIC3njHqO3EuL40WlmBu B/y4a6Qrqg0jlSI+k3w8B5IuTaQluHtj1sqn6MQ4vgSFhROvOeqgDCvxN4CxTnFrtu6c iPwMY4Uxhiq/nvf2TL3PrzoHWFIZI6PZdKcS26xML2N/mcwaVX2UNxXaOtXhNzpNo6i3 AUwUFFao/JbGnif6Km1iSptxApdZ/lDW2UsVy/8IkBBGbGVAO+I7g5ltODkcYVOWIT4T LdcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YluD/coS8sexmlFolx3+oGig9zE5xcfh7wKXW1nzJF8=; b=PVL3GOKjwDJ0B9ZHvVPB5OEYZn7/PehXdJy5KwuMjLVKmdmIj/8UaEQivoCzqemhyX 8p96b6lUMtfTobUNxjlfeQyrPfgTkmVJMxJQXis5tmtCs7duTcR8EXtfCO0BDguU6g65 t46eDyaO80tVsk+du7zKJhSxwbZMI8uQ7PFvPCQ2Px5B4SJ6+oaYQToeSJATqtxG/98A cg+NZz2iqKQkcgL69ehhGY3uJ4SC/Sa8FwDOQ6rH33+tEh46BmXlBfXMY22SiTjGJLqU mzyoJ/kim++xUN79lwuiSuwCbCMng8TQxC1G/19zJY2XXlG43eSLSKDVxYGuFvl7h3ON b45w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GlelumZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m11si5540151edp.113.2021.09.16.22.08.23; Thu, 16 Sep 2021 22:08:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=GlelumZY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355863AbhIPRtV (ORCPT + 99 others); Thu, 16 Sep 2021 13:49:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:57072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355378AbhIPRlY (ORCPT ); Thu, 16 Sep 2021 13:41:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F0A526325F; Thu, 16 Sep 2021 16:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631811161; bh=We1WAH98abIdQl6WDRwYDdwBqGyJa6AdZyPB/uCcD+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GlelumZY/s755cilsg6uAkNT07moi4pCLjpKd+eXda4UYQbg3BgyemZPthLeUjKUG Xd8QOlG4FdsnDWMfryawWUD3s7BhF1bq4oVPZ0RhDccqG93U/wWTaDGLDWIKiOG8Sw VECUIVa2BlLNeYOCQw05vVHAah54SRwHRWGP0CoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Hildenbrand , Pankaj Gupta , Muchun Song , Oscar Salvador , Vitaly Kuznetsov , "Michael S. Tsirkin" , Jason Wang , Pankaj Gupta , Wei Yang , Michal Hocko , Dan Williams , Anshuman Khandual , Dave Hansen , Vlastimil Babka , Mike Rapoport , "Rafael J. Wysocki" , Len Brown , Pavel Tatashin , Heiko Carstens , Michael Ellerman , Catalin Marinas , virtualization@lists.linux-foundation.org, Andy Lutomirski , "Aneesh Kumar K.V" , Anton Blanchard , Ard Biesheuvel , Baoquan He , Benjamin Herrenschmidt , Borislav Petkov , Christian Borntraeger , Christophe Leroy , Dave Jiang , "H. Peter Anvin" , Ingo Molnar , Jia He , Joe Perches , Kefeng Wang , Laurent Dufour , Michel Lespinasse , Nathan Lynch , Nicholas Piggin , Paul Mackerras , Peter Zijlstra , Pierre Morel , "Rafael J. Wysocki" , Rich Felker , Scott Cheloha , Sergei Trofimovich , Thiago Jung Bauermann , Thomas Gleixner , Vasily Gorbik , Vishal Verma , Will Deacon , Yoshinori Sato , Andrew Morton , Linus Torvalds Subject: [PATCH 5.14 404/432] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() Date: Thu, 16 Sep 2021 18:02:33 +0200 Message-Id: <20210916155824.533541303@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Hildenbrand commit 7cf209ba8a86410939a24cb1aeb279479a7e0ca6 upstream. 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 Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- include/linux/memory_hotplug.h | 4 ++-- mm/memory_hotplug.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) --- a/include/linux/memory_hotplug.h +++ b/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 +++ b/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);