From: Baoquan He <bhe@redhat.com>
To: Pavel Tatashin <pasha.tatashin@oracle.com>
Cc: steven.sistare@oracle.com, daniel.m.jordan@oracle.com,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
kirill.shutemov@linux.intel.com, mhocko@suse.com,
linux-mm@kvack.org, dan.j.williams@intel.com, jack@suse.cz,
jglisse@redhat.com, jrdr.linux@gmail.com,
gregkh@linuxfoundation.org, vbabka@suse.cz,
richard.weiyang@gmail.com, dave.hansen@intel.com,
rientjes@google.com, mingo@kernel.org,
osalvador@techadventures.net
Subject: Re: [PATCH v3 1/2] mm/sparse: add sparse_init_nid()
Date: Mon, 2 Jul 2018 10:11:21 +0800 [thread overview]
Message-ID: <20180702021121.GL3223@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20180702020417.21281-2-pasha.tatashin@oracle.com>
Hi Pavel,
Thanks for your quick fix. You might have missed another comment to v2
patch 1/2 which is at the bottom.
On 07/01/18 at 10:04pm, Pavel Tatashin wrote:
> +/*
> + * Initialize sparse on a specific node. The node spans [pnum_begin, pnum_end)
> + * And number of present sections in this node is map_count.
> + */
> +void __init sparse_init_nid(int nid, unsigned long pnum_begin,
> + unsigned long pnum_end,
> + unsigned long map_count)
> +{
> + unsigned long pnum, usemap_longs, *usemap, map_index;
> + struct page *map, *map_base;
> +
> + usemap_longs = BITS_TO_LONGS(SECTION_BLOCKFLAGS_BITS);
> + usemap = sparse_early_usemaps_alloc_pgdat_section(NODE_DATA(nid),
> + usemap_size() *
> + map_count);
> + if (!usemap) {
> + pr_err("%s: usemap allocation failed", __func__);
> + goto failed;
> + }
> + map_base = sparse_populate_node(pnum_begin, pnum_end,
> + map_count, nid);
> + map_index = 0;
> + for_each_present_section_nr(pnum_begin, pnum) {
> + if (pnum >= pnum_end)
> + break;
> +
> + BUG_ON(map_index == map_count);
> + map = sparse_populate_node_section(map_base, map_index,
> + pnum, nid);
> + if (!map) {
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".
> + pr_err("%s: memory map backing failed. Some memory will not be available.",
> + __func__);
> + pnum_begin = pnum;
> + goto failed;
> + }
> + check_usemap_section_nr(nid, usemap);
> + sparse_init_one_section(__nr_to_section(pnum), pnum, map,
> + usemap);
> + map_index++;
> + usemap += usemap_longs;
> + }
> + return;
> +failed:
> + /* We failed to allocate, mark all the following pnums as not present */
> + for_each_present_section_nr(pnum_begin, pnum) {
> + struct mem_section *ms;
> +
> + if (pnum >= pnum_end)
> + break;
> + ms = __nr_to_section(pnum);
> + ms->section_mem_map = 0;
> + }
> +}
> +
> /*
> * Allocate the accumulated non-linear sections, allocate a mem_map
> * for each and record the physical to section mapping.
> --
> 2.18.0
>
next prev parent reply other threads:[~2018-07-02 2:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 2:04 [PATCH v3 0/2] sparse_init rewrite Pavel Tatashin
2018-07-02 2:04 ` [PATCH v3 1/2] mm/sparse: add sparse_init_nid() Pavel Tatashin
2018-07-02 2:11 ` Baoquan He [this message]
2018-07-02 2:18 ` Pavel Tatashin
2018-07-02 2:31 ` Baoquan He
2018-07-02 2:43 ` Pavel Tatashin
2018-07-02 2:53 ` Baoquan He
2018-07-02 3:03 ` Pavel Tatashin
2018-07-02 3:14 ` Baoquan He
2018-07-02 3:17 ` Baoquan He
2018-07-02 3:28 ` Pavel Tatashin
2018-07-02 3:42 ` Baoquan He
2018-07-02 2:56 ` Baoquan He
2018-07-02 3:05 ` Pavel Tatashin
2018-07-02 19:59 ` Dave Hansen
2018-07-02 20:29 ` Pavel Tatashin
2018-07-05 13:39 ` Dave Hansen
2018-07-09 14:31 ` Pavel Tatashin
2018-07-02 2:04 ` [PATCH v3 2/2] mm/sparse: start using sparse_init_nid(), and remove old code Pavel Tatashin
2018-07-02 14:04 ` Oscar Salvador
2018-07-02 19:47 ` Dave Hansen
2018-07-02 19:54 ` Pavel Tatashin
2018-07-02 20:00 ` Dave Hansen
2018-07-02 20:12 ` Pavel Tatashin
2018-07-02 16:20 ` [PATCH v3 0/2] sparse_init rewrite Dave Hansen
2018-07-02 17:46 ` Pavel Tatashin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180702021121.GL3223@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=daniel.m.jordan@oracle.com \
--cc=dave.hansen@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=jglisse@redhat.com \
--cc=jrdr.linux@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=osalvador@techadventures.net \
--cc=pasha.tatashin@oracle.com \
--cc=richard.weiyang@gmail.com \
--cc=rientjes@google.com \
--cc=steven.sistare@oracle.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).