Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1473946
| From | David Rientjes <rientjes@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] cpu: Fix node state for whether it contains CPU |
| Date | 2016-09-01 00:50 +0200 |
| Message-ID | <scmut-8mg-25@gated-at.bofh.it> (permalink) |
| References | <sbzap-2aw-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, 29 Aug 2016, Tim Chen wrote:
> In current kernel code, we only call node_set_state(cpu_to_node(cpu),
> N_CPU) when a cpu is hot plugged. But we do not set the node state for
> N_CPU when the cpus are brought online during boot.
>
> So this could lead to failure when we check to see
> if a node contains cpu with node_state(node_id, N_CPU).
>
> One use case is in the node_reclaime function:
>
> /*
> * Only run node reclaim on the local node or on nodes that do
> * not
> * have associated processors. This will favor the local
> * processor
> * over remote processors and spread off node memory allocations
> * as wide as possible.
> */
> if (node_state(pgdat->node_id, N_CPU) && pgdat->node_id !=
> numa_node_id())
> return NODE_RECLAIM_NOSCAN;
>
> I instrumented the kernel to call this function after boot and it
> always returns 0 on a x86 desktop machine until I apply
> the attached patch.
>
> int num_cpu_node(void)
> {
> int i, nr_cpu_nodes = 0;
>
> for_each_node(i) {
> if (node_state(i, N_CPU))
> ++ nr_cpu_nodes;
> }
>
> return nr_cpu_nodes;
> }
>
> Fix this by checking each node for online CPU when we initialize
> vmstat that's responsible for maintaining node state.
>
That would mean that when node_reclaim_mode is enabled that we weren't
properly returning NODE_RECLAIM_NOSCAN if a remote node had its own cpus
and PGDAT_RECLAIM_LOCKED wasn't already set, so this seems like it could
result in a performance improvement.
> v2:
> 1. Fix the problem for all architectures in the generic path
> inside vmstat, not just for x86.
>
> Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2] cpu: Fix node state for whether it contains CPU Tim Chen <tim.c.chen@linux.intel.com> - 2016-08-29 20:10 +0200 Re: [PATCH v2] cpu: Fix node state for whether it contains CPU David Rientjes <rientjes@google.com> - 2016-09-01 00:50 +0200
csiph-web