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: <CACZJ9cVSxsOcGJwxEWaMs3Wtt0XHij5OiYq+uWvC7UQZApNGdw@mail.gmail.com>
Date:   Sun, 18 Jun 2023 15:30:36 +0800
From:   Liam Ni <zhiguangni01@...il.com>
To:     Mike Rapoport <rppt@...nel.org>
Cc:     dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
        tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, hpa@...or.com,
        akpm@...ux-foundation.org, x86@...nel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH] x86,NUMA:Get the number of ram pages directly in numa_meminfo_cover_memory()

Hi,

On Sun, 18 Jun 2023 at 15:09, Mike Rapoport <rppt@...nel.org> wrote:
>
> On Sat, Jun 17, 2023 at 06:47:11PM +0800, Liam Ni wrote:
> > On Fri, 16 Jun 2023 at 01:00, Mike Rapoport <rppt@...nel.org> wrote:
> > >
> > > On Fri, Jun 16, 2023 at 12:20:16AM +1000, Liam Ni wrote:
> > > > In a previous implementation,The ram page is calculated
> > > > by counting the number of holes,
> > > > however,the number of ram pages is calculated during hole calculation.
> > > > Therefore,we can directly calculate the amount of ram pages.
> > > >
> > > > Signed-off-by: Liam Ni <zhiguangni01@...il.com>
> > > > ---
> > > >  arch/x86/mm/numa.c |  4 ++--
> > > >  include/linux/mm.h |  4 ++++
> > > >  mm/mm_init.c       | 33 +++++++++++++++++++++++++++++++++
> > > >  3 files changed, 39 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
> > > > index 2aadb2019b4f..8ea0e956e3d7 100644
> > > > --- a/arch/x86/mm/numa.c
> > > > +++ b/arch/x86/mm/numa.c
> > > > @@ -461,12 +461,12 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
> > > >               u64 s = mi->blk[i].start >> PAGE_SHIFT;
> > > >               u64 e = mi->blk[i].end >> PAGE_SHIFT;
> > > >               numaram += e - s;
> > > > -             numaram -= __absent_pages_in_range(mi->blk[i].nid, s, e);
> > > > +             numaram += __available_pages_in_range(mi->blk[i].nid, s, e);
> > >
> > > This is wrong. You add number of pages in range core MM sees to the number
> > > of pages covered by the numa_meminfo.
> > >
> > > More generally, rather than traverse all the numa_meminfo's and for each of
> > > them traverse all the regions in memblock.memory it's enough to count
> > > memory in memblock that doesn't have the node assigned and compare it to
> > > memblock_phys_mem_size().
> >
> > Logic like below?
> > static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
> > {
> >    u64 error_value;
> >    error_value = pages_without_nid_in_range(0,max_pfn);
> >     if ((error_value ) >= (1 << (20 - PAGE_SHIFT))) {
> >         //print error information
> >         return false;
> >      }
> >      return true;
> > }
> >
> > I can't figure out why compare it with memblock_phys_mem_size().
> > The number of pages in memblock that doesn't have the node
> > assigned,which also means that these pages are not in numa_info.
> > So these pages can represent the number of lose pages.
>
> Yes, there is no need to compare with memblock_phys_mem_size() if you count
> pages that don't have nid set in memblock.

Got it,i will send V2.

Liam.
>
> --
> Sincerely yours,
> Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ