From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
cl@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com,
ntl@pobox.com, mel@csn.ul.ie, suresh.b.siddha@intel.com,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
rusty@rustcorp.com.au, steiner@sgi.com, rientjes@google.com,
containers@lists.linux-foundation.org
Subject: Re: [PATCH] x86: only clear node_states for 64bit
Date: Mon, 29 Jun 2009 00:39:58 -0700 [thread overview]
Message-ID: <4A486FCE.4070206@kernel.org> (raw)
In-Reply-To: <4A4683B2.106@kernel.org>
Yinghai Lu wrote:
> Ingo Molnar wrote:
>> * Yinghai Lu <yinghai@kernel.org> wrote:
>>
>>> Andrew Morton wrote:
>>>> On Mon, 22 Jun 2009 08:38:50 -0700
>>>> Yinghai Lu <yinghai@kernel.org> wrote:
>>>>
>>>>> Nathan reported that
>>>>> | commit 73d60b7f747176dbdff826c4127d22e1fd3f9f74
>>>>> | Author: Yinghai Lu <yinghai@kernel.org>
>>>>> | Date: Tue Jun 16 15:33:00 2009 -0700
>>>>> |
>>>>> | page-allocator: clear N_HIGH_MEMORY map before we set it again
>>>>> |
>>>>> | SRAT tables may contains nodes of very small size. The arch code may
>>>>> | decide to not activate such a node. However, currently the early boot
>>>>> | code sets N_HIGH_MEMORY for such nodes. These nodes therefore seem to be
>>>>> | active although these nodes have no present pages.
>>>>> |
>>>>> | For 64bit N_HIGH_MEMORY == N_NORMAL_MEMORY, so that works for 64 bit too
>>>>>
>>>>> the cpuset.mems cgroup attribute on an i386 kvm guest
>>>>>
>>>>> fix it by only clearing node_states[N_NORMAL_MEMORY] for 64bit only.
>>>>> and need to do save/restore for that in find_zone_movable_pfn
>>>>>
>>>> There appear to be some words omitted from this changelog - it doesn't
>>>> make sense.
>>>>
>>>> I think that perhaps a line got deleted before "the cpuset.mems cgroup
>>>> ...". That was the line which actualy describes the bug which we're
>>>> fixing. Or perhaps it was a single word? "zeroes".
>>>>
>>>>
>>>> I did this:
>>>>
>>>> Nathan reported that
>>>> :
>>>> : | commit 73d60b7f747176dbdff826c4127d22e1fd3f9f74
>>>> : | Author: Yinghai Lu <yinghai@kernel.org>
>>>> : | Date: Tue Jun 16 15:33:00 2009 -0700
>>>> : |
>>>> : | page-allocator: clear N_HIGH_MEMORY map before we set it again
>>>> : |
>>>> : | SRAT tables may contains nodes of very small size. The arch code may
>>>> : | decide to not activate such a node. However, currently the early boot
>>>> : | code sets N_HIGH_MEMORY for such nodes. These nodes therefore seem to be
>>>> : | active although these nodes have no present pages.
>>>> : |
>>>> : | For 64bit N_HIGH_MEMORY == N_NORMAL_MEMORY, so that works for 64 bit too
>>>> :
>>> "
>>>> : unintentionally and incorrectly clears the cpuset.mems cgroup attribute on
>>>> : an i386 kvm guest
>>> "
>>> ==>
>>>
>>> 32bit assume NORMAL_MEMORY bit and HIGH_MEMORY bit are set for
>>> Node0 always.
>> Where in the code is this assumption?
>
> in mm/page_alloc.c
> /*
> * Array of node states.
> */
> nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
> [N_POSSIBLE] = NODE_MASK_ALL,
> [N_ONLINE] = { { [0] = 1UL } },
> #ifndef CONFIG_NUMA
> [N_NORMAL_MEMORY] = { { [0] = 1UL } },
> #ifdef CONFIG_HIGHMEM
> [N_HIGH_MEMORY] = { { [0] = 1UL } },
> #endif
> [N_CPU] = { { [0] = 1UL } },
> #endif /* NUMA */
> };
> EXPORT_SYMBOL(node_states);
>
> for x86 64bit, we clear POSSIBLE and ONLINE in arch/x86/mm/numa_64.c::initmem_init
> and this patch clear NORMAL in arch/x86/mm/init_64.c::paging_init
>
> for x86 32bit: ONLINE get cleared in get_memcfg_from_srat()
> and NORMAL and HIGH_MEMORY are not cleared
> before try to set new in mm/page_alloc.c::free_area_init_nodes
>
>>> and some code only check if HIGH_MEMORY is there to know if
>>> NORMAL_MEMORY is there.
>> Which code is that exactly?
>>
> with grep:
> arch/x86/mm/init_64.c: nodes_clear(node_states[N_NORMAL_MEMORY]);
> drivers/base/node.c: return print_nodes_state(N_NORMAL_MEMORY, buf);
> include/linux/nodemask.h: N_NORMAL_MEMORY, /* The node has regular memory */
> include/linux/nodemask.h: N_HIGH_MEMORY = N_NORMAL_MEMORY,
> mm/memcontrol.c: if (!node_state(node, N_NORMAL_MEMORY))
> mm/page_alloc.c: [N_NORMAL_MEMORY] = { { [0] = 1UL } },
> mm/page_alloc.c: node_set_state(zone_to_nid(zone), N_NORMAL_MEMORY);
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY) {
> mm/slub.c: for_each_node_state(node, N_NORMAL_MEMORY)
>
> Documentation/cgroups/cpusets.txt:automatically tracks the value of node_states[N_HIGH_MEMORY]--i.e.,
> Documentation/memory-hotplug.txt:status_change_nid is set node id when N_HIGH_MEMORY of nodemask is (will be)
> arch/ia64/kernel/uncached.c: if (!node_state(nid, N_HIGH_MEMORY))
> drivers/base/node.c: return print_nodes_state(N_HIGH_MEMORY, buf);
> include/linux/cpuset.h:#define cpuset_current_mems_allowed (node_states[N_HIGH_MEMORY])
> include/linux/nodemask.h: N_HIGH_MEMORY, /* The node has regular or high memory */
> include/linux/nodemask.h: N_HIGH_MEMORY = N_NORMAL_MEMORY,
> kernel/cpuset.c: * found any online mems, return node_states[N_HIGH_MEMORY].
> kernel/cpuset.c: * of node_states[N_HIGH_MEMORY].
> kernel/cpuset.c: node_states[N_HIGH_MEMORY]))
> kernel/cpuset.c: node_states[N_HIGH_MEMORY]);
> kernel/cpuset.c: *pmask = node_states[N_HIGH_MEMORY];
> kernel/cpuset.c: BUG_ON(!nodes_intersects(*pmask, node_states[N_HIGH_MEMORY]));
> kernel/cpuset.c: * top_cpuset.mems_allowed tracks node_stats[N_HIGH_MEMORY];
> kernel/cpuset.c: node_states[N_HIGH_MEMORY]))
> kernel/cpuset.c: nodes_subset(cp->mems_allowed, node_states[N_HIGH_MEMORY]))
> kernel/cpuset.c: node_states[N_HIGH_MEMORY]);
> kernel/cpuset.c: * Keep top_cpuset.mems_allowed tracking node_states[N_HIGH_MEMORY].
> kernel/cpuset.c: * Call this routine anytime after node_states[N_HIGH_MEMORY] changes.
> kernel/cpuset.c: top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
> kernel/cpuset.c: top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
> kernel/cpuset.c: * subset of node_states[N_HIGH_MEMORY], even if this means going outside the
> mm/memcontrol.c: for_each_node_state(node, N_HIGH_MEMORY) {
> mm/memory_hotplug.c: node_set_state(zone_to_nid(zone), N_HIGH_MEMORY);
> mm/mempolicy.c: if (!nodes_subset(new, node_states[N_HIGH_MEMORY])) {
> mm/mempolicy.c: for_each_node_state(nid, N_HIGH_MEMORY) {
> mm/mempolicy.c: if (!nodes_subset(nodes, node_states[N_HIGH_MEMORY]))
> mm/mempolicy.c: nodes = node_states[N_HIGH_MEMORY];
> mm/mempolicy.c: &node_states[N_HIGH_MEMORY], MPOL_MF_STATS, md);
> mm/mempolicy.c: for_each_node_state(n, N_HIGH_MEMORY)
> mm/migrate.c: if (!node_state(node, N_HIGH_MEMORY))
> mm/oom_kill.c: nodemask_t nodes = node_states[N_HIGH_MEMORY];
> mm/page-writeback.c: for_each_node_state(node, N_HIGH_MEMORY) {
> mm/page_alloc.c: [N_HIGH_MEMORY] = { { [0] = 1UL } },
> mm/page_alloc.c: * tasks mems_allowed, or node_states[N_HIGH_MEMORY].)
> mm/page_alloc.c: &node_states[N_HIGH_MEMORY];
> mm/page_alloc.c: for_each_node_state(n, N_HIGH_MEMORY) {
> mm/page_alloc.c: (nodes_weight(node_states[N_HIGH_MEMORY]) + 1);
> mm/page_alloc.c: * Populate N_HIGH_MEMORY for calculating usable_nodes.
> mm/page_alloc.c: node_set_state(early_node_map[i].nid, N_HIGH_MEMORY);
> mm/page_alloc.c: nodemask_t saved_node_state = node_states[N_HIGH_MEMORY];
> mm/page_alloc.c: int usable_nodes = nodes_weight(node_states[N_HIGH_MEMORY]);
> mm/page_alloc.c: for_each_node_state(nid, N_HIGH_MEMORY) {
> mm/page_alloc.c: node_states[N_HIGH_MEMORY] = saved_node_state;
> mm/page_alloc.c: node_set_state(nid, N_HIGH_MEMORY);
> mm/vmalloc.c: for_each_node_state(nr, N_HIGH_MEMORY)
> mm/vmscan.c: for_each_node_state(nid, N_HIGH_MEMORY) {
> mm/vmscan.c: for_each_node_state(nid, N_HIGH_MEMORY)
> mm/vmstat.c: if (!node_state(pgdat->node_id, N_HIGH_MEMORY))
>
> for 64bit N_HIGH_MEMORY == NORMAL_MEMORY
>
> for 32bit, there are more reference to N_HIGH_MEMORY...
>
- Why is this patch good/desired?
fix the broken with cpuset.mems cgroup attribute on an i386 kvm guest
- What did prior code do, and why was that wrong?
clear node_states[N_HIGH_MEMORY] for 32 bit and 64bit.
actually we only need clear that for 64bit to make that right for some strange
case like small range in one node.
- What were the bad effects. (crash, right?)
cpuset.mems can not be used ...
- What does this patch do to achieve that good status?
fix the problem with cpuset.mems and only keep the clearing for x86 64bit.
YH
next prev parent reply other threads:[~2009-06-29 7:42 UTC|newest]
Thread overview: 90+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-09 6:45 [PATCH 1/3] x86: remove MEMORY_HOTPLUG_RESERVE related code Yinghai Lu
2009-05-09 6:48 ` [PATCH 2/3] x86: add numa_move_cpus_to_node Yinghai Lu
2009-05-09 7:05 ` Justin P. Mattock
2009-05-12 1:27 ` Christoph Lameter
2009-05-11 21:53 ` Yinghai Lu
2009-05-12 20:59 ` Christoph Lameter
2009-05-12 17:16 ` Yinghai Lu
2009-05-12 21:21 ` Christoph Lameter
2009-05-13 5:39 ` Yinghai Lu
2009-05-14 19:34 ` Christoph Lameter
2009-05-14 20:58 ` Yinghai Lu
2009-05-09 6:50 ` [PATCH 3/3] x86: fix node_possible_map logic -v2 Yinghai Lu
2009-05-11 17:53 ` Jack Steiner
2009-05-11 19:15 ` Yinghai Lu
2009-05-11 19:36 ` Yinghai Lu
2009-05-11 19:27 ` David Rientjes
2009-05-11 21:12 ` H. Peter Anvin
2009-05-11 21:26 ` Alan Cox
2009-05-11 22:25 ` David Rientjes
2009-05-12 15:06 ` Jack Steiner
2009-05-12 15:10 ` Yinghai Lu
2009-05-12 16:16 ` Jack Steiner
2009-05-12 16:40 ` Yinghai Lu
2009-05-12 18:03 ` Jack Steiner
2009-05-12 21:31 ` Yinghai Lu
2009-05-12 21:58 ` Jack Steiner
2009-05-12 23:13 ` Yinghai Lu
2009-05-12 23:26 ` Yinghai Lu
2009-05-12 15:43 ` Andi Kleen
2009-05-13 1:34 ` [PATCH] x86: fix system without memory on node0 Yinghai Lu
2009-05-13 8:00 ` Andi Kleen
2009-05-13 15:58 ` Yinghai Lu
2009-05-13 13:35 ` Ingo Molnar
2009-05-13 16:52 ` Jack Steiner
2009-05-13 17:43 ` Yinghai Lu
2009-05-13 18:08 ` Yinghai Lu
2009-05-12 7:15 ` [PATCH 3/3] x86: fix node_possible_map logic -v2 Andi Kleen
2009-05-11 21:33 ` Jack Steiner
2009-05-11 22:56 ` David Rientjes
2009-05-11 23:00 ` Yinghai Lu
2009-05-12 7:09 ` Andi Kleen
2009-05-12 1:02 ` [PATCH 1/3] x86: remove MEMORY_HOTPLUG_RESERVE related code Christoph Lameter
2009-05-12 11:16 ` Mel Gorman
2009-05-13 5:29 ` Yinghai Lu
2009-05-13 9:55 ` Mel Gorman
2009-05-13 6:13 ` [PATCH] x86: remove MEMORY_HOTPLUG_RESERVE related code -v2 Yinghai Lu
2009-05-13 14:59 ` Mel Gorman
2009-05-14 16:38 ` [PATCH 1/5] " Yinghai Lu
2009-05-14 16:40 ` [PATCH 2/5] x86: add numa_move_cpus_to_node Yinghai Lu
2009-05-14 16:41 ` [PATCH 3/5] x86: fix node_possible_map logic -v2 Yinghai Lu
2009-05-18 7:40 ` [tip:x86/mm] x86, mm: Fix node_possible_map logic tip-bot for Yinghai Lu
2009-05-14 16:42 ` [PATCH 4/5] x86: fix system without memory on node0 -v2 Yinghai Lu
2009-05-18 7:40 ` [tip:x86/mm] x86: fix system without memory on node0 tip-bot for Yinghai Lu
2009-05-14 16:43 ` [PATCH 5/5] mm: clear N_HIGH_MEMORY map before se set it again -v2 Yinghai Lu
2009-05-14 16:54 ` Andrew Morton
2009-05-14 17:05 ` Yinghai Lu
2009-05-14 17:25 ` Andrew Morton
2009-05-14 17:34 ` Yinghai Lu
2009-05-14 19:44 ` Christoph Lameter
2009-06-04 5:16 ` [RESEND PATCH] " Yinghai Lu
2009-06-04 16:38 ` Christoph Lameter
2009-06-04 16:48 ` Yinghai Lu
2009-06-04 17:11 ` Christoph Lameter
2009-06-04 17:26 ` [PATCH] mm: clear N_HIGH_MEMORY map before se set it again -v4 Yinghai Lu
2009-06-19 6:42 ` Nathan Lynch
2009-06-19 8:18 ` Yinghai Lu
2009-06-19 8:43 ` Nathan Lynch
2009-06-19 16:16 ` Yinghai Lu
2009-06-20 23:43 ` Yinghai Lu
2009-06-22 4:39 ` Nathan Lynch
2009-06-22 15:38 ` [PATCH] x86: only clear node_states for 64bit Yinghai Lu
2009-06-26 20:54 ` Andrew Morton
2009-06-26 21:09 ` Yinghai Lu
2009-06-27 17:17 ` Ingo Molnar
2009-06-27 20:40 ` Yinghai Lu
2009-06-29 7:39 ` Yinghai Lu [this message]
2009-05-18 7:39 ` [tip:x86/mm] mm, x86: remove MEMORY_HOTPLUG_RESERVE related code tip-bot for Yinghai Lu
[not found] ` <20090511095022.GA23121@elte.hu>
[not found] ` <20090511163158.c4e4d334.akpm@linux-foundation.org>
[not found] ` <20090512090704.GC18004@elte.hu>
[not found] ` <4A0A6700.3070100@kernel.org>
[not found] ` <20090513133635.GB7384@elte.hu>
[not found] ` <4A0AFA6E.5050200@kernel.org>
[not found] ` <20090515173521.GA29647@elte.hu>
2009-05-15 21:38 ` tip: patches in git for irq and numa Yinghai Lu
2009-05-18 7:29 ` Ingo Molnar
2009-05-18 13:50 ` Peter Zijlstra
2009-05-18 13:56 ` Ingo Molnar
2009-05-18 15:03 ` Yinghai Lu
2009-05-18 15:09 ` Ingo Molnar
2009-05-18 15:11 ` Peter Zijlstra
2009-05-18 17:23 ` Yinghai Lu
2009-05-19 9:37 ` Ingo Molnar
2009-05-19 10:31 ` Peter Zijlstra
2009-05-19 12:26 ` Ingo Molnar
2009-05-19 9:39 ` [tip:irq/numa] x86, io-apic: Don't mark pin_programmed early tip-bot for Yinghai Lu
2009-05-19 12:30 ` tip-bot for Yinghai Lu
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=4A486FCE.4070206@kernel.org \
--to=yinghai@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=containers@lists.linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=mingo@elte.hu \
--cc=ntl@pobox.com \
--cc=rientjes@google.com \
--cc=rusty@rustcorp.com.au \
--cc=steiner@sgi.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/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
Powered by JetHome