[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGM2rebUsJ2r-2F38Vv13zbaEPPgTn0w6H3j6fpg0WVa9wB6Uw@mail.gmail.com>
Date: Sun, 1 Jul 2018 22:43:09 -0400
From: Pavel Tatashin <pasha.tatashin@...cle.com>
To: bhe@...hat.com
Cc: Steven Sistare <steven.sistare@...cle.com>,
Daniel Jordan <daniel.m.jordan@...cle.com>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
kirill.shutemov@...ux.intel.com, Michal Hocko <mhocko@...e.com>,
Linux Memory Management List <linux-mm@...ck.org>,
dan.j.williams@...el.com, jack@...e.cz, jglisse@...hat.com,
Souptick Joarder <jrdr.linux@...il.com>,
gregkh@...uxfoundation.org, Vlastimil Babka <vbabka@...e.cz>,
Wei Yang <richard.weiyang@...il.com>, dave.hansen@...el.com,
rientjes@...gle.com, mingo@...nel.org, osalvador@...hadventures.net
Subject: Re: [PATCH v3 1/2] mm/sparse: add sparse_init_nid()
On Sun, Jul 1, 2018 at 10:31 PM Baoquan He <bhe@...hat.com> wrote:
>
> On 07/01/18 at 10:18pm, Pavel Tatashin wrote:
> > > Here, I think it might be not right to jump to 'failed' directly if one
> > > section of the node failed to populate memmap. I think the original code
> > > is only skipping the section which memmap failed to populate by marking
> > > it as not present with "ms->section_mem_map = 0".
> > >
> >
> > Hi Baoquan,
> >
> > Thank you for a careful review. This is an intended change compared to
> > the original code. Because we operate per-node now, if we fail to
> > allocate a single section, in this node, it means we also will fail to
> > allocate all the consequent sections in the same node and no need to
> > check them anymore. In the original code we could not simply bailout,
> > because we still might have valid entries in the following nodes.
> > Similarly, sparse_init() will call sparse_init_nid() for the next node
> > even if previous node failed to setup all the memory.
>
> Hmm, say the node we are handling is node5, and there are 100 sections.
> If you allocate memmap for section at one time, you have succeeded to
> handle for the first 99 sections, now the 100th failed, so you will mark
> all sections on node5 as not present. And the allocation failure is only
> for single section memmap allocation case.
No, unless I am missing something, that's not how code works:
463 if (!map) {
464 pr_err("%s: memory map backing failed.
Some memory will not be available.",
465 __func__);
466 pnum_begin = pnum;
467 goto failed;
468 }
476 failed:
477 /* We failed to allocate, mark all the following pnums as
not present */
478 for_each_present_section_nr(pnum_begin, pnum) {
We continue from the pnum that failed as we set pnum_begin to pnum,
and mark all the consequent sections as not-present.
The only change compared to the original code is that once we found an
empty pnum we stop checking the consequent pnums in this node, as we
know they are empty as well, because there is no more memory in this
node to allocate from.
Pavel
Powered by blists - more mailing lists