linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Joonsoo Kim <js1304@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: Han Pingtian <hanpt@linux.vnet.ibm.com>,
	Nishanth Aravamudan <nacc@linux.vnet.ibm.com>,
	Pekka Enberg <penberg@kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Paul Mackerras <paulus@samba.org>,
	Anton Blanchard <anton@samba.org>, Matt Mackall <mpm@selenic.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linuxppc-dev@lists.ozlabs.org, Christoph Lameter <cl@linux.com>,
	Wanpeng Li <liwanp@linux.vnet.ibm.com>
Subject: Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node
Date: Thu, 6 Feb 2014 19:29:16 +0900	[thread overview]
Message-ID: <CAAmzW4PXkdpNi5pZ=4BzdXNvqTEAhcuw-x0pWidqrxzdePxXxA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1402060041040.21148@chino.kir.corp.google.com>

2014-02-06 David Rientjes <rientjes@google.com>:
> On Thu, 6 Feb 2014, Joonsoo Kim wrote:
>
>> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>>
>
> I may be misunderstanding this patch and there's no help because there's
> no changelog.

Sorry about that.
I made this patch just for testing. :)
Thanks for looking this.

>> diff --git a/include/linux/topology.h b/include/linux/topology.h
>> index 12ae6ce..a6d5438 100644
>> --- a/include/linux/topology.h
>> +++ b/include/linux/topology.h
>> @@ -233,11 +233,20 @@ static inline int numa_node_id(void)
>>   * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
>>   */
>>  DECLARE_PER_CPU(int, _numa_mem_);
>> +int _node_numa_mem_[MAX_NUMNODES];
>>
>>  #ifndef set_numa_mem
>>  static inline void set_numa_mem(int node)
>>  {
>>       this_cpu_write(_numa_mem_, node);
>> +     _node_numa_mem_[numa_node_id()] = node;
>> +}
>> +#endif
>> +
>> +#ifndef get_numa_mem
>> +static inline int get_numa_mem(int node)
>> +{
>> +     return _node_numa_mem_[node];
>>  }
>>  #endif
>>
>> @@ -260,6 +269,7 @@ static inline int cpu_to_mem(int cpu)
>>  static inline void set_cpu_numa_mem(int cpu, int node)
>>  {
>>       per_cpu(_numa_mem_, cpu) = node;
>> +     _node_numa_mem_[numa_node_id()] = node;
>
> The intention seems to be that _node_numa_mem_[X] for a node X will return
> a node Y with memory that has the nearest distance?  In other words,
> caching the value returned by local_memory_node(X)?

Yes, you are right.

> That doesn't seem to be what it's doing since numa_node_id() is the node
> of the cpu that current is running on so this ends up getting initialized
> to whatever local_memory_node(cpu_to_node(cpu)) is for the last bit set in
> cpu_possible_mask.

Yes, I made a mistake.
Thanks for pointer.
I fix it and attach v2.
Now I'm out of office, so I'm not sure this second version is correct :(

Thanks.

----------8<--------------
>From bf691e7eb07f966e3aed251eaeb18f229ee32d1f Mon Sep 17 00:00:00 2001
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Date: Thu, 6 Feb 2014 17:07:05 +0900
Subject: [RFC PATCH 2/3 v2] topology: support node_numa_mem() for
determining the
 fallback node

We need to determine the fallback node in slub allocator if the allocation
target node is memoryless node. Without it, the SLUB wrongly select
the node which has no memory and can't use a partial slab, because of node
mismatch. Introduced function, node_numa_mem(X), will return
a node Y with memory that has the nearest distance. If X is memoryless
node, it will return nearest distance node, but, if
X is normal node, it will return itself.

We will use this function in following patch to determine the fallback
node.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/include/linux/topology.h b/include/linux/topology.h
index 12ae6ce..66b19b8 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -233,11 +233,20 @@ static inline int numa_node_id(void)
  * Use the accessor functions set_numa_mem(), numa_mem_id() and cpu_to_mem().
  */
 DECLARE_PER_CPU(int, _numa_mem_);
+int _node_numa_mem_[MAX_NUMNODES];

 #ifndef set_numa_mem
 static inline void set_numa_mem(int node)
 {
  this_cpu_write(_numa_mem_, node);
+ _node_numa_mem_[numa_node_id()] = node;
+}
+#endif
+
+#ifndef get_numa_mem
+static inline int get_numa_mem(int node)
+{
+ return _node_numa_mem_[node];
 }
 #endif

@@ -260,6 +269,7 @@ static inline int cpu_to_mem(int cpu)
 static inline void set_cpu_numa_mem(int cpu, int node)
 {
  per_cpu(_numa_mem_, cpu) = node;
+ _node_numa_mem_[cpu_to_node(cpu)] = node;
 }
 #endif

@@ -273,6 +283,13 @@ static inline int numa_mem_id(void)
 }
 #endif

+#ifndef get_numa_mem
+static inline int get_numa_mem(int node)
+{
+ return node;
+}
+#endif
+
 #ifndef cpu_to_mem
 static inline int cpu_to_mem(int cpu)
 {
-- 
1.7.9.5

  reply	other threads:[~2014-02-06 10:29 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07  2:21 [PATCH] slub: Don't throw away partial remote slabs if there is no local memory Anton Blanchard
2014-01-07  4:19 ` Wanpeng Li
2014-01-08 14:17   ` Anton Blanchard
2014-01-07  6:49 ` Andi Kleen
2014-01-08 14:03   ` Anton Blanchard
2014-01-07  7:41 ` Joonsoo Kim
2014-01-07  8:48   ` Wanpeng Li
     [not found]   ` <52cbbf7b.2792420a.571c.ffffd476SMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-07  9:10     ` Joonsoo Kim
2014-01-07  9:21       ` Wanpeng Li
     [not found]       ` <52cbc738.c727440a.5ead.27a3SMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-07  9:31         ` Joonsoo Kim
2014-01-07  9:49           ` Wanpeng Li
2014-01-07  9:52   ` Wanpeng Li
     [not found]   ` <52cbce84.aa71b60a.537c.ffffd9efSMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-09  0:20     ` Joonsoo Kim
2014-01-20  9:10   ` Wanpeng Li
     [not found]   ` <52dce7fe.e5e6420a.5ff6.ffff84a0SMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-20 22:13     ` Christoph Lameter
2014-01-21  2:20       ` Wanpeng Li
2014-01-24  3:09       ` Wanpeng Li
     [not found]       ` <52e1d960.2715420a.3569.1013SMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-24  3:14         ` Wanpeng Li
     [not found]         ` <52e1da8f.86f7440a.120f.25f3SMTPIN_ADDED_BROKEN@mx.google.com>
2014-01-24 15:50           ` Christoph Lameter
2014-01-24 21:03             ` David Rientjes
2014-01-24 22:19               ` Nishanth Aravamudan
2014-01-24 23:29               ` Nishanth Aravamudan
2014-01-24 23:49                 ` David Rientjes
2014-01-25  0:16                   ` Nishanth Aravamudan
2014-01-25  0:25                     ` David Rientjes
2014-01-25  1:10                       ` Nishanth Aravamudan
2014-01-27  5:58                         ` Joonsoo Kim
2014-01-28 18:29                           ` Nishanth Aravamudan
2014-01-29 15:54                             ` Christoph Lameter
2014-01-29 22:36                             ` Nishanth Aravamudan
2014-01-30 16:26                               ` Christoph Lameter
2014-02-03 23:00                             ` Nishanth Aravamudan
2014-02-04  3:38                               ` Christoph Lameter
2014-02-04  7:26                                 ` Nishanth Aravamudan
2014-02-04 20:39                                   ` Christoph Lameter
2014-02-05  0:13                                     ` Nishanth Aravamudan
2014-02-05 19:28                                       ` Christoph Lameter
2014-02-06  2:08                                         ` Nishanth Aravamudan
2014-02-06 17:25                                           ` Christoph Lameter
2014-01-27 16:18                         ` Christoph Lameter
2014-02-06  2:07                       ` Nishanth Aravamudan
2014-02-06  8:04                         ` Joonsoo Kim
     [not found]                           ` <20140206185955.GA7845@linux.vnet.ibm.com>
2014-02-06 19:28                             ` Nishanth Aravamudan
2014-02-07  8:03                               ` Joonsoo Kim
2014-02-06  8:07                         ` [RFC PATCH 1/3] slub: search partial list on numa_mem_id(), instead of numa_node_id() Joonsoo Kim
2014-02-06  8:07                           ` [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node Joonsoo Kim
2014-02-06  8:52                             ` David Rientjes
2014-02-06 10:29                               ` Joonsoo Kim [this message]
2014-02-06 19:11                                 ` Nishanth Aravamudan
2014-02-07  5:42                                   ` Joonsoo Kim
2014-02-06 20:52                                 ` David Rientjes
2014-02-07  5:48                                   ` Joonsoo Kim
2014-02-07 17:53                                     ` Christoph Lameter
2014-02-07 18:51                                       ` Christoph Lameter
2014-02-07 21:38                                         ` Nishanth Aravamudan
2014-02-10  1:15                                           ` Joonsoo Kim
2014-02-10  1:29                                         ` Joonsoo Kim
2014-02-11 18:45                                           ` Christoph Lameter
2014-02-10 19:13                                         ` Nishanth Aravamudan
2014-02-11  7:42                                           ` Joonsoo Kim
2014-02-12 22:16                                             ` Christoph Lameter
2014-02-13  3:53                                               ` Nishanth Aravamudan
2014-02-17  6:52                                               ` Joonsoo Kim
2014-02-18 16:38                                                 ` Christoph Lameter
2014-02-19 22:04                                                   ` David Rientjes
2014-02-20 16:02                                                     ` Christoph Lameter
2014-02-24  5:08                                                   ` Joonsoo Kim
2014-02-24 19:54                                                     ` Christoph Lameter
2014-03-13 16:51                                                       ` Nishanth Aravamudan
2014-02-18 17:22                                               ` Nishanth Aravamudan
2014-02-13  6:51                                             ` Nishanth Aravamudan
2014-02-17  7:00                                               ` Joonsoo Kim
2014-02-18 16:57                                                 ` Christoph Lameter
2014-02-18 17:28                                                   ` Nishanth Aravamudan
2014-02-18 19:58                                                     ` Christoph Lameter
2014-02-18 21:09                                                       ` Nishanth Aravamudan
2014-02-18 21:49                                                         ` Christoph Lameter
2014-02-18 22:22                                                           ` Nishanth Aravamudan
2014-02-19 16:11                                                             ` Christoph Lameter
2014-02-19 22:03                                                       ` David Rientjes
2014-02-08  9:57                                     ` David Rientjes
2014-02-10  1:09                                       ` Joonsoo Kim
2014-07-22  1:03                                         ` Nishanth Aravamudan
2014-07-22  1:16                                           ` David Rientjes
2014-07-22 21:43                                             ` Nishanth Aravamudan
2014-07-22 21:49                                               ` Tejun Heo
2014-07-22 23:47                                               ` Nishanth Aravamudan
2014-07-23  0:43                                               ` David Rientjes
2014-02-06  8:07                           ` [RFC PATCH 3/3] slub: fallback to get_numa_mem() node if we want to allocate on memoryless node Joonsoo Kim
2014-02-06 17:30                             ` Christoph Lameter
2014-02-07  5:41                               ` Joonsoo Kim
2014-02-07 17:49                                 ` Christoph Lameter
2014-02-10  1:22                                   ` Joonsoo Kim
2014-02-06  8:37                           ` [RFC PATCH 1/3] slub: search partial list on numa_mem_id(), instead of numa_node_id() David Rientjes
2014-02-06 17:31                             ` Christoph Lameter
2014-02-06 17:26                           ` Christoph Lameter
2014-05-16 23:37                           ` Nishanth Aravamudan
2014-05-19  2:41                             ` Joonsoo Kim
2014-06-05  0:13                           ` [RESEND PATCH] " David Rientjes
2014-01-27 16:24                     ` [PATCH] slub: Don't throw away partial remote slabs if there is no local memory Christoph Lameter
2014-01-27 16:16                   ` Christoph Lameter
2014-01-07  9:42 ` David Laight
2014-01-08 14:14   ` Anton Blanchard
2014-01-07 10:28 ` Wanpeng Li

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='CAAmzW4PXkdpNi5pZ=4BzdXNvqTEAhcuw-x0pWidqrxzdePxXxA@mail.gmail.com' \
    --to=js1304@gmail.com \
    --cc=anton@samba.org \
    --cc=cl@linux.com \
    --cc=hanpt@linux.vnet.ibm.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=liwanp@linux.vnet.ibm.com \
    --cc=mpm@selenic.com \
    --cc=nacc@linux.vnet.ibm.com \
    --cc=paulus@samba.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /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).