Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2564373lkm; Mon, 20 Sep 2021 18:50:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyR0714uE2JsA2/ShxVRaYxDF3w5wrFI+WZ5u51TCFehph9iEam68RqaezEzBcBmAzw1/lE X-Received: by 2002:a92:7f0a:: with SMTP id a10mr20387212ild.22.1632189011446; Mon, 20 Sep 2021 18:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189011; cv=none; d=google.com; s=arc-20160816; b=BVKJCfDnTlzlmsZU/wED16Ng4fv7ioo8N5usN6ZO8PYQOXvnRKJAAnYrOlW4Qf83sj yw+mduU2mpF38KCv5PurA6qpa9K9y463v/0EH3Hnw0dbFs8/pEFqC72WE0TQea+GL796 1KKM9bUAHjds1Gu4ib0dMmbgt75H/r8VO6W4UAlsGv7waXL2H0JKmu67Jose8vYNyqjH ullxUg09o5bjLqtjFXt1+wH9NY6YSf2bO1aPb92NV8d1DQNALReWJwt2gMTFF8hkZNDs RBjTTpVjMDAS13doEo7Snwha0FOQy4TJV3zB7Bvf6bhFMLESqPS3PMIIXHkOiCX0h3La p6yQ== 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=JqMjEtbLzwO+JMb3g6NcFLMDotenfmvtdurNdEcGk/M=; b=iWrrquBT8sGMXh/HxyoTUZR7U7wfRVe2wCTJPyNYm9WFZG1JKN+BPibx4C5QTAcPX+ EWeYQZiYPTEyiFNaF2gPWytByR16DepcnetsyOkfLDxZJ6X+jtQXwITdvzeFNLsurFYI p6gGlZoatN+ceIZ6/eTVH7tdGhzFCGoYL1gErwVdArSCaYrcFR2nZ4hu7yPlRm6tjryj 7RUF5u1+f2rVEkuuuOb6QsnY5QaDpEBfgtr3Z+wIKNPLiuZcXKuVinf6NQGXywK9JMaw 7rjhFraOqU4L2iuZLQwXCqXhyUS2qVpmaI/fxOzId1tfHUS2XHSQFlGJxZRaun77RDfE 6LKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jVJJ+E+O; 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 x6si15849586ilv.93.2021.09.20.18.49.58; Mon, 20 Sep 2021 18:50:11 -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=jVJJ+E+O; 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 S1350147AbhITSC3 (ORCPT + 99 others); Mon, 20 Sep 2021 14:02:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:54554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354387AbhITRzz (ORCPT ); Mon, 20 Sep 2021 13:55:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26C0B619EE; Mon, 20 Sep 2021 17:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158056; bh=vnDx+FAgvXBGFE4mzB1titc8sw7HkALXbKlAHCbdROk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jVJJ+E+O+PdZgvujoTqsNmCkQrh2RfUf3exmV0/igodjvKSMs3maOdJusjCLJ3MFd DA0YNspy7PoQMOEvLkTRqv0PSzPeOe/OvCCk8s1nk66zo0I8BoWArrK2f7QgzFiZWI GwSH2QiC7PUsUKPevEhzQuTMsn4qvNNS8bK2uFVQ= 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 4.19 273/293] mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range() Date: Mon, 20 Sep 2021 18:43:55 +0200 Message-Id: <20210920163942.759283241@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@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: David Hildenbrand 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 @@ -344,6 +344,6 @@ extern struct page *sparse_decode_mem_ma unsigned long pnum); extern bool allow_online_pfn_range(int nid, unsigned long pfn, unsigned long nr_pages, int online_type); -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); #endif /* __LINUX_MEMORY_HOTPLUG_H */ --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -783,8 +783,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);