Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-12 Thread Anshuman Khandual


On 11/12/2018 09:40 AM, Anshuman Khandual wrote:
> 
> 
> On 11/12/2018 09:27 AM, Joseph Qi wrote:
>> For ocfs2 part, node means host in the cluster, not NUMA node.
>>
> 
> Does not -1 indicate an invalid node which can never be present ?
> 

My bad, got it wrong. Seems like this is nothing to do with NUMA node
at all. Will drop the changes from ocfs2.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-12 Thread Joseph Qi
For ocfs2 part, node means host in the cluster, not NUMA node.

Thanks,
Joseph

On 18/11/12 10:41, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
> 
> Signed-off-by: Anshuman Khandual 
> ---
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc64le etc with their default config which might not have
> compiled tested all driver related changes. I will appreciate folks giving
> this a test in their respective build environment.
> 
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.
> 
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
> 
>  arch/alpha/include/asm/topology.h |  2 +-
>  arch/ia64/kernel/numa.c   |  2 +-
>  arch/ia64/mm/discontig.c  |  6 +++---
>  arch/ia64/sn/kernel/io_common.c   |  2 +-
>  arch/powerpc/include/asm/pci-bridge.h |  2 +-
>  arch/powerpc/kernel/paca.c|  2 +-
>  arch/powerpc/kernel/pci-common.c  |  2 +-
>  arch/powerpc/mm/numa.c| 14 +++---
>  arch/powerpc/platforms/powernv/memtrace.c |  4 ++--
>  arch/sparc/kernel/auxio_32.c  |  2 +-
>  arch/sparc/kernel/pci_fire.c  |  2 +-
>  arch/sparc/kernel/pci_schizo.c|  2 +-
>  arch/sparc/kernel/pcic.c  |  6 +++---
>  arch/sparc/kernel/psycho_common.c |  2 +-
>  arch/sparc/kernel/sbus.c  |  2 +-
>  arch/sparc/mm/init_64.c   |  6 +++---
>  arch/sparc/prom/init_32.c |  2 +-
>  arch/sparc/prom/init_64.c |  4 ++--
>  arch/sparc/prom/tree_32.c | 12 ++--
>  arch/sparc/prom/tree_64.c | 18 +-
>  arch/x86/include/asm/pci.h|  2 +-
>  arch/x86/kernel/apic/x2apic_uv_x.c|  6 +++---
>  arch/x86/kernel/smpboot.c |  2 +-
>  arch/x86/platform/olpc/olpc_dt.c  | 16 
>  drivers/block/mtip32xx/mtip32xx.c |  4 ++--
>  drivers/dma/dmaengine.c   |  3 ++-
>  drivers/infiniband/hw/hfi1/affinity.c |  2 +-
>  drivers/infiniband/hw/hfi1/init.c |  2 +-
>  drivers/iommu/dmar.c  |  4 ++--
>  drivers/iommu/intel-iommu.c   |  2 +-
>  drivers/media/pci/ivtv/ivtvfb.c   |  2 +-
>  drivers/media/platform/vivid/vivid-osd.c  |  2 +-
>  drivers/misc/sgi-xp/xpc_uv.c  |  2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  4 ++--
>  drivers/video/fbdev/mmp/fb/mmpfb.c|  2 +-
>  drivers/video/fbdev/pxa168fb.c|  2 +-
>  drivers/video/fbdev/w100fb.c  |  2 +-
>  fs/ocfs2/dlm/dlmcommon.h  |  2 +-
>  fs/ocfs2/dlm/dlmdomain.c  | 10 +-
>  fs/ocfs2/dlm/dlmmaster.c  |  2 +-
>  fs/ocfs2/dlm/dlmrecovery.c|  2 +-
>  fs/ocfs2/stack_user.c |  6 +++---
>  init/init_task.c  |  2 +-
>  kernel/kthread.c  |  2 +-
>  kernel/sched/fair.c   | 15 ---
>  lib/cpumask.c |  2 +-
>  mm/huge_memory.c  | 12 ++--
>  mm/hugetlb.c  |  2 +-
>  mm/ksm.c  |  2 +-
>  mm/memory.c   |  6 +++---
>  mm/memory_hotplug.c   | 12 ++--
>  mm/mempolicy.c|  2 +-
>  mm/page_alloc.c   |  4 ++--
>  mm/page_ext.c |  2 +-
>  net/core/pktgen.c |  2 +-
>  net/qrtr/qrtr.c   |  2 +-
>  tools/perf/bench/numa.c   |  6 +++---
>  57 files changed, 125 insertions(+), 123 deletions(-)
> 
> diff --git a/arch/alpha/include/asm/topology.h 
> b/arch/alpha/include/asm/topology.h
> index e6e13a8..f6dc89c 100644
> --- a/arch/alpha/include/asm/topology.h
> +++ b/arch/alpha/include/asm/topology.h
> @@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
>  {
>   int cpu;
>  
> - if (node 

[RFC] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-12 Thread Anshuman Khandual
At present there are multiple places where invalid node number is encoded
as -1. Even though implicitly understood it is always better to have macros
in there. Replace these open encodings for an invalid node number with the
global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
'invalid node' from various places redirecting them to a common definition.

Signed-off-by: Anshuman Khandual 
---
Build tested this with multiple cross compiler options like alpha, sparc,
arm64, x86, powerpc64le etc with their default config which might not have
compiled tested all driver related changes. I will appreciate folks giving
this a test in their respective build environment.

All these places for replacement were found by running the following grep
patterns on the entire kernel code. Please let me know if this might have
missed some instances. This might also have replaced some false positives.
I will appreciate suggestions, inputs and review.

1. git grep "nid == -1"
2. git grep "node == -1"
3. git grep "nid = -1"
4. git grep "node = -1"

 arch/alpha/include/asm/topology.h |  2 +-
 arch/ia64/kernel/numa.c   |  2 +-
 arch/ia64/mm/discontig.c  |  6 +++---
 arch/ia64/sn/kernel/io_common.c   |  2 +-
 arch/powerpc/include/asm/pci-bridge.h |  2 +-
 arch/powerpc/kernel/paca.c|  2 +-
 arch/powerpc/kernel/pci-common.c  |  2 +-
 arch/powerpc/mm/numa.c| 14 +++---
 arch/powerpc/platforms/powernv/memtrace.c |  4 ++--
 arch/sparc/kernel/auxio_32.c  |  2 +-
 arch/sparc/kernel/pci_fire.c  |  2 +-
 arch/sparc/kernel/pci_schizo.c|  2 +-
 arch/sparc/kernel/pcic.c  |  6 +++---
 arch/sparc/kernel/psycho_common.c |  2 +-
 arch/sparc/kernel/sbus.c  |  2 +-
 arch/sparc/mm/init_64.c   |  6 +++---
 arch/sparc/prom/init_32.c |  2 +-
 arch/sparc/prom/init_64.c |  4 ++--
 arch/sparc/prom/tree_32.c | 12 ++--
 arch/sparc/prom/tree_64.c | 18 +-
 arch/x86/include/asm/pci.h|  2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c|  6 +++---
 arch/x86/kernel/smpboot.c |  2 +-
 arch/x86/platform/olpc/olpc_dt.c  | 16 
 drivers/block/mtip32xx/mtip32xx.c |  4 ++--
 drivers/dma/dmaengine.c   |  3 ++-
 drivers/infiniband/hw/hfi1/affinity.c |  2 +-
 drivers/infiniband/hw/hfi1/init.c |  2 +-
 drivers/iommu/dmar.c  |  4 ++--
 drivers/iommu/intel-iommu.c   |  2 +-
 drivers/media/pci/ivtv/ivtvfb.c   |  2 +-
 drivers/media/platform/vivid/vivid-osd.c  |  2 +-
 drivers/misc/sgi-xp/xpc_uv.c  |  2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  4 ++--
 drivers/video/fbdev/mmp/fb/mmpfb.c|  2 +-
 drivers/video/fbdev/pxa168fb.c|  2 +-
 drivers/video/fbdev/w100fb.c  |  2 +-
 fs/ocfs2/dlm/dlmcommon.h  |  2 +-
 fs/ocfs2/dlm/dlmdomain.c  | 10 +-
 fs/ocfs2/dlm/dlmmaster.c  |  2 +-
 fs/ocfs2/dlm/dlmrecovery.c|  2 +-
 fs/ocfs2/stack_user.c |  6 +++---
 init/init_task.c  |  2 +-
 kernel/kthread.c  |  2 +-
 kernel/sched/fair.c   | 15 ---
 lib/cpumask.c |  2 +-
 mm/huge_memory.c  | 12 ++--
 mm/hugetlb.c  |  2 +-
 mm/ksm.c  |  2 +-
 mm/memory.c   |  6 +++---
 mm/memory_hotplug.c   | 12 ++--
 mm/mempolicy.c|  2 +-
 mm/page_alloc.c   |  4 ++--
 mm/page_ext.c |  2 +-
 net/core/pktgen.c |  2 +-
 net/qrtr/qrtr.c   |  2 +-
 tools/perf/bench/numa.c   |  6 +++---
 57 files changed, 125 insertions(+), 123 deletions(-)

diff --git a/arch/alpha/include/asm/topology.h 
b/arch/alpha/include/asm/topology.h
index e6e13a8..f6dc89c 100644
--- a/arch/alpha/include/asm/topology.h
+++ b/arch/alpha/include/asm/topology.h
@@ -29,7 +29,7 @@ static const struct cpumask *cpumask_of_node(int node)
 {
int cpu;
 
-   if (node == -1)
+   if (node == NUMA_NO_NODE)
return cpu_all_mask;
 
cpumask_clear(_to_cpumask_map[node]);
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index 92c3762..1315da6 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -74,7 +74,7 @@ void 

Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-12 Thread Anshuman Khandual


On 11/12/2018 09:27 AM, Joseph Qi wrote:
> For ocfs2 part, node means host in the cluster, not NUMA node.
> 

Does not -1 indicate an invalid node which can never be present ?
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-12 Thread Anshuman Khandual


On 11/12/2018 02:13 PM, Hans Verkuil wrote:
> On 11/12/2018 03:41 AM, Anshuman Khandual wrote:
>> At present there are multiple places where invalid node number is encoded
>> as -1. Even though implicitly understood it is always better to have macros
>> in there. Replace these open encodings for an invalid node number with the
>> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
>> 'invalid node' from various places redirecting them to a common definition.
>>
>> Signed-off-by: Anshuman Khandual 
>> ---
>> Build tested this with multiple cross compiler options like alpha, sparc,
>> arm64, x86, powerpc64le etc with their default config which might not have
>> compiled tested all driver related changes. I will appreciate folks giving
>> this a test in their respective build environment.
>>
>> All these places for replacement were found by running the following grep
>> patterns on the entire kernel code. Please let me know if this might have
>> missed some instances. This might also have replaced some false positives.
>> I will appreciate suggestions, inputs and review.
> The 'node' in the drivers/media and the drivers/video sources has nothing to
> do with numa. It's an index for a framebuffer instead (i.e. the X in 
> /dev/fbX).

Thanks for the input. Will drop the changes there.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RFC] mm: Replace all open encodings for NUMA_NO_NODE

2018-11-12 Thread Hans Verkuil
On 11/12/2018 03:41 AM, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
> 
> Signed-off-by: Anshuman Khandual 
> ---
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc64le etc with their default config which might not have
> compiled tested all driver related changes. I will appreciate folks giving
> this a test in their respective build environment.
> 
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.

The 'node' in the drivers/media and the drivers/video sources has nothing to
do with numa. It's an index for a framebuffer instead (i.e. the X in /dev/fbX).

Regards,

Hans

> 
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
> 
>  arch/alpha/include/asm/topology.h |  2 +-
>  arch/ia64/kernel/numa.c   |  2 +-
>  arch/ia64/mm/discontig.c  |  6 +++---
>  arch/ia64/sn/kernel/io_common.c   |  2 +-
>  arch/powerpc/include/asm/pci-bridge.h |  2 +-
>  arch/powerpc/kernel/paca.c|  2 +-
>  arch/powerpc/kernel/pci-common.c  |  2 +-
>  arch/powerpc/mm/numa.c| 14 +++---
>  arch/powerpc/platforms/powernv/memtrace.c |  4 ++--
>  arch/sparc/kernel/auxio_32.c  |  2 +-
>  arch/sparc/kernel/pci_fire.c  |  2 +-
>  arch/sparc/kernel/pci_schizo.c|  2 +-
>  arch/sparc/kernel/pcic.c  |  6 +++---
>  arch/sparc/kernel/psycho_common.c |  2 +-
>  arch/sparc/kernel/sbus.c  |  2 +-
>  arch/sparc/mm/init_64.c   |  6 +++---
>  arch/sparc/prom/init_32.c |  2 +-
>  arch/sparc/prom/init_64.c |  4 ++--
>  arch/sparc/prom/tree_32.c | 12 ++--
>  arch/sparc/prom/tree_64.c | 18 +-
>  arch/x86/include/asm/pci.h|  2 +-
>  arch/x86/kernel/apic/x2apic_uv_x.c|  6 +++---
>  arch/x86/kernel/smpboot.c |  2 +-
>  arch/x86/platform/olpc/olpc_dt.c  | 16 
>  drivers/block/mtip32xx/mtip32xx.c |  4 ++--
>  drivers/dma/dmaengine.c   |  3 ++-
>  drivers/infiniband/hw/hfi1/affinity.c |  2 +-
>  drivers/infiniband/hw/hfi1/init.c |  2 +-
>  drivers/iommu/dmar.c  |  4 ++--
>  drivers/iommu/intel-iommu.c   |  2 +-
>  drivers/media/pci/ivtv/ivtvfb.c   |  2 +-
>  drivers/media/platform/vivid/vivid-osd.c  |  2 +-
>  drivers/misc/sgi-xp/xpc_uv.c  |  2 +-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  4 ++--
>  drivers/video/fbdev/mmp/fb/mmpfb.c|  2 +-
>  drivers/video/fbdev/pxa168fb.c|  2 +-
>  drivers/video/fbdev/w100fb.c  |  2 +-
>  fs/ocfs2/dlm/dlmcommon.h  |  2 +-
>  fs/ocfs2/dlm/dlmdomain.c  | 10 +-
>  fs/ocfs2/dlm/dlmmaster.c  |  2 +-
>  fs/ocfs2/dlm/dlmrecovery.c|  2 +-
>  fs/ocfs2/stack_user.c |  6 +++---
>  init/init_task.c  |  2 +-
>  kernel/kthread.c  |  2 +-
>  kernel/sched/fair.c   | 15 ---
>  lib/cpumask.c |  2 +-
>  mm/huge_memory.c  | 12 ++--
>  mm/hugetlb.c  |  2 +-
>  mm/ksm.c  |  2 +-
>  mm/memory.c   |  6 +++---
>  mm/memory_hotplug.c   | 12 ++--
>  mm/mempolicy.c|  2 +-
>  mm/page_alloc.c   |  4 ++--
>  mm/page_ext.c |  2 +-
>  net/core/pktgen.c |  2 +-
>  net/qrtr/qrtr.c   |  2 +-
>  tools/perf/bench/numa.c   |  6 +++---
>  57 files changed, 125 insertions(+), 123 deletions(-)
> 
> diff --git a/arch/alpha/include/asm/topology.h 
> b/arch/alpha/include/asm/topology.h
> index e6e13a8..f6dc89c 100644
> --- a/arch/alpha/include/asm/topology.h
> +++ b/arch/alpha/include/asm/topology.h
> @@ -29,7