lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9Jb+hj8uGc0N16Guui9kaA6W46QHzAET44Zt8C7kRdRAXMOA@mail.gmail.com>
Date:   Wed, 14 Jul 2021 22:47:38 +0200
From:   Pankaj Gupta <pankaj.gupta.linux@...il.com>
To:     David Hildenbrand <david@...hat.com>
Cc:     LKML <linux-kernel@...r.kernel.org>, Linux MM <linux-mm@...ck.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>,
        Wei Yang <richard.weiyang@...ux.alibaba.com>,
        Oscar Salvador <osalvador@...e.de>,
        Michal Hocko <mhocko@...nel.org>,
        Dan Williams <dan.j.williams@...el.com>,
        Anshuman Khandual <anshuman.khandual@....com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Mike Rapoport <rppt@...nel.org>,
        "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>,
        Pavel Tatashin <pasha.tatashin@...een.com>,
        Heiko Carstens <hca@...ux.ibm.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Catalin Marinas <catalin.marinas@....com>,
        virtualization@...ts.linux-foundation.org,
        linux-acpi@...r.kernel.org, Andy Lutomirski <luto@...nel.org>,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
        Anton Blanchard <anton@...abs.org>,
        Ard Biesheuvel <ardb@...nel.org>, Baoquan He <bhe@...hat.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Borislav Petkov <bp@...en8.de>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        Christophe Leroy <christophe.leroy@....fr>,
        Dave Jiang <dave.jiang@...el.com>,
        "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
        Jia He <justin.he@....com>, Joe Perches <joe@...ches.com>,
        Kefeng Wang <wangkefeng.wang@...wei.com>,
        Laurent Dufour <ldufour@...ux.ibm.com>,
        Michel Lespinasse <michel@...pinasse.org>,
        Nathan Lynch <nathanl@...ux.ibm.com>,
        Nicholas Piggin <npiggin@...il.com>,
        Paul Mackerras <paulus@...ba.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Pierre Morel <pmorel@...ux.ibm.com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Rich Felker <dalias@...c.org>,
        Scott Cheloha <cheloha@...ux.ibm.com>,
        Sergei Trofimovich <slyfox@...too.org>,
        Thiago Jung Bauermann <bauerman@...ux.ibm.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Will Deacon <will@...nel.org>,
        Yoshinori Sato <ysato@...rs.sourceforge.jp>,
        "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
        linux-arm-kernel@...ts.infradead.org, linux-ia64@...r.kernel.org,
        linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org,
        linux-sh@...r.kernel.org
Subject: Re: [PATCH v1 2/4] mm/memory_hotplug: remove nid parameter from arch_remove_memory()

> The parameter is unused, let's remove it.
>
> Acked-by: Catalin Marinas <catalin.marinas@....com>
> Acked-by: Michael Ellerman <mpe@...erman.id.au> (powerpc)
> Acked-by: Heiko Carstens <hca@...ux.ibm.com> (s390)
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Will Deacon <will@...nel.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Heiko Carstens <hca@...ux.ibm.com>
> Cc: Vasily Gorbik <gor@...ux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@...ibm.com>
> Cc: Yoshinori Sato <ysato@...rs.sourceforge.jp>
> Cc: Rich Felker <dalias@...c.org>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Andy Lutomirski <luto@...nel.org>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: x86@...nel.org
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Anshuman Khandual <anshuman.khandual@....com>
> Cc: Ard Biesheuvel <ardb@...nel.org>
> Cc: Mike Rapoport <rppt@...nel.org>
> Cc: Nicholas Piggin <npiggin@...il.com>
> Cc: Pavel Tatashin <pasha.tatashin@...een.com>
> Cc: Baoquan He <bhe@...hat.com>
> Cc: Laurent Dufour <ldufour@...ux.ibm.com>
> Cc: Sergei Trofimovich <slyfox@...too.org>
> Cc: Kefeng Wang <wangkefeng.wang@...wei.com>
> Cc: Michel Lespinasse <michel@...pinasse.org>
> Cc: Christophe Leroy <christophe.leroy@....fr>
> Cc: "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>
> Cc: Thiago Jung Bauermann <bauerman@...ux.ibm.com>
> Cc: Joe Perches <joe@...ches.com>
> Cc: Pierre Morel <pmorel@...ux.ibm.com>
> Cc: Jia He <justin.he@....com>
> Cc: linux-arm-kernel@...ts.infradead.org
> Cc: linux-ia64@...r.kernel.org
> Cc: linuxppc-dev@...ts.ozlabs.org
> Cc: linux-s390@...r.kernel.org
> Cc: linux-sh@...r.kernel.org
> Signed-off-by: David Hildenbrand <david@...hat.com>
> ---
>  arch/arm64/mm/mmu.c            | 3 +--
>  arch/ia64/mm/init.c            | 3 +--
>  arch/powerpc/mm/mem.c          | 3 +--
>  arch/s390/mm/init.c            | 3 +--
>  arch/sh/mm/init.c              | 3 +--
>  arch/x86/mm/init_32.c          | 3 +--
>  arch/x86/mm/init_64.c          | 3 +--
>  include/linux/memory_hotplug.h | 3 +--
>  mm/memory_hotplug.c            | 4 ++--
>  mm/memremap.c                  | 5 +----
>  10 files changed, 11 insertions(+), 22 deletions(-)
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index d74586508448..af8ab553a268 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -1506,8 +1506,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return ret;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index 064a967a7b6e..5c6da8d83c1a 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -484,8 +484,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return ret;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index ad198b439222..c3c4e31462ec 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -119,8 +119,7 @@ int __ref arch_add_memory(int nid, u64 start, u64 size,
>         return rc;
>  }
>
> -void __ref arch_remove_memory(int nid, u64 start, u64 size,
> -                             struct vmem_altmap *altmap)
> +void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
> index 8ac710de1ab1..d85bd7f5d8dc 100644
> --- a/arch/s390/mm/init.c
> +++ b/arch/s390/mm/init.c
> @@ -306,8 +306,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return rc;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index ce26c7f8950a..506784702430 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -414,8 +414,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return ret;
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = PFN_DOWN(start);
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
> index 74b78840182d..bd90b8fe81e4 100644
> --- a/arch/x86/mm/init_32.c
> +++ b/arch/x86/mm/init_32.c
> @@ -801,8 +801,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
>         return __add_pages(nid, start_pfn, nr_pages, params);
>  }
>
> -void arch_remove_memory(int nid, u64 start, u64 size,
> -                       struct vmem_altmap *altmap)
> +void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index ddeaba947eb3..a6e11763763f 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -1255,8 +1255,7 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
>         remove_pagetable(start, end, true, NULL);
>  }
>
> -void __ref arch_remove_memory(int nid, u64 start, u64 size,
> -                             struct vmem_altmap *altmap)
> +void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>  {
>         unsigned long start_pfn = start >> PAGE_SHIFT;
>         unsigned long nr_pages = size >> PAGE_SHIFT;
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index d01b504ce06f..010a192298b5 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -130,8 +130,7 @@ static inline bool movable_node_is_enabled(void)
>         return movable_node_enabled;
>  }
>
> -extern void arch_remove_memory(int nid, u64 start, u64 size,
> -                              struct vmem_altmap *altmap);
> +extern void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap);
>  extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,
>                            struct vmem_altmap *altmap);
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 93b3abaf9828..f2a9af3af184 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1106,7 +1106,7 @@ int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
>         /* create memory block devices after memory was added */
>         ret = create_memory_block_devices(start, size, mhp_altmap.alloc);
>         if (ret) {
> -               arch_remove_memory(nid, start, size, NULL);
> +               arch_remove_memory(start, size, NULL);
>                 goto error;
>         }
>
> @@ -1892,7 +1892,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size)
>
>         mem_hotplug_begin();
>
> -       arch_remove_memory(nid, start, size, altmap);
> +       arch_remove_memory(start, size, altmap);
>
>         if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
>                 memblock_free(start, size);
> diff --git a/mm/memremap.c b/mm/memremap.c
> index 15a074ffb8d7..ed593bf87109 100644
> --- a/mm/memremap.c
> +++ b/mm/memremap.c
> @@ -140,14 +140,11 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
>  {
>         struct range *range = &pgmap->ranges[range_id];
>         struct page *first_page;
> -       int nid;
>
>         /* make sure to access a memmap that was actually initialized */
>         first_page = pfn_to_page(pfn_first(pgmap, range_id));
>
>         /* pages are dead and unused, undo the arch mapping */
> -       nid = page_to_nid(first_page);
> -
>         mem_hotplug_begin();
>         remove_pfn_range_from_zone(page_zone(first_page), PHYS_PFN(range->start),
>                                    PHYS_PFN(range_len(range)));
> @@ -155,7 +152,7 @@ static void pageunmap_range(struct dev_pagemap *pgmap, int range_id)
>                 __remove_pages(PHYS_PFN(range->start),
>                                PHYS_PFN(range_len(range)), NULL);
>         } else {
> -               arch_remove_memory(nid, range->start, range_len(range),
> +               arch_remove_memory(range->start, range_len(range),
>                                 pgmap_altmap(pgmap));
>                 kasan_remove_zero_shadow(__va(range->start), range_len(range));
>         }

Reviewed-by: Pankaj Gupta <pankaj.gupta@...os.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ