[PATCH v3 09/11] mm/page_alloc: factor zone_pageset_init() out of setup_zone_pageset()

2013-04-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b0762c7..749b6e1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4076,22 +4076,25 @@ static void

[PATCH v3 05/11] mm/page_alloc: convert zone_pcp_update() to rely on memory barriers instead of stop_machine()

2013-04-10 Thread Cody P Schafer
n zone_pcp_update() is called (they will end up being shrunk, not completely drained, later when a 0-order page is freed in free_hot_cold_page()). Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 33 + 1 file changed, 9 insertions(+), 24 deletions(-) diff --git

[PATCH v3 06/11] mm/page_alloc: when handling percpu_pagelist_fraction, don't unneedly recalulate high

2013-04-10 Thread Cody P Schafer
Simply moves calculation of the new 'high' value outside the for_each_possible_cpu() loop, as it does not depend on the cpu. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_all

[PATCH v3 11/11] mm/page_alloc: rename setup_pagelist_highmark() to match naming of pageset_set_batch()

2013-04-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5ee5ce9..038e9d2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4037,7 +4037,7 @@ static void pageset_update(struct

[PATCH v3 01/11] mm/page_alloc: factor out setting of pcp->high and pcp->batch.

2013-04-10 Thread Cody P Schafer
Creates pageset_set_batch() for use in setup_pageset(). pageset_set_batch() imitates the functionality of setup_pagelist_highmark(), but uses the boot time (percpu_pagelist_fraction == 0) calculations for determining ->high based on ->batch. Signed-off-by: Cody P Schafer --- mm/page_a

[PATCH v3 07/11] mm/page_alloc: factor setup_pageset() into pageset_init() and pageset_set_batch()

2013-04-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3447a4b..352c279a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4043,7 +4043,7 @@ static void pageset_set_batch(struct

[PATCH v3 03/11] mm/page_alloc: insert memory barriers to allow async update of pcp batch and high

2013-04-10 Thread Cody P Schafer
ids ->batch ever rising above ->high. Suggested by Gilad Ben-Yossef in these threads: https://lkml.org/lkml/2013/4/9/23 https://lkml.org/lkml/2013/4/10/49 Also reproduces his proposed comment. Reviewed-by: Gilad Ben-Yossef Signed-off-by: Cody P Schafer --- mm/page_all

[PATCH v3 04/11] mm/page_alloc: protect pcp->batch accesses with ACCESS_ONCE

2013-04-10 Thread Cody P Schafer
pcp->batch could change at any point, avoid relying on it being a stable value. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f2929df..9dd0dc0 100644 --- a/mm/page_allo

[PATCH v3 08/11] mm/page_alloc: relocate comment to be directly above code it refers to.

2013-04-10 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 352c279a..b0762c7 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3683,12 +3683,12 @@ void __ref build_all_zonelists(pg_data_t

Re: [PATCH v2 03/10] mm/page_alloc: insert memory barriers to allow async update of pcp batch and high

2013-04-10 Thread Cody P Schafer
On 04/09/2013 11:22 PM, Gilad Ben-Yossef wrote: On Wed, Apr 10, 2013 at 9:19 AM, Gilad Ben-Yossef wrote: On Wed, Apr 10, 2013 at 2:28 AM, Cody P Schafer wrote: In pageset_set_batch() and setup_pagelist_highmark(), ensure that batch is always set to a safe value (1) prior to updating high

Re: [PATCH v3 00/11] mm: fixup changers of per cpu pageset's ->high and ->batch

2013-04-10 Thread Cody P Schafer
On 04/10/2013 02:23 PM, Andrew Morton wrote: On Wed, 10 Apr 2013 11:23:28 -0700 Cody P Schafer wrote: "Problems" with the current code: 1. there is a lack of synchronization in setting ->high and ->batch in percpu_pagelist_fraction_sysctl_handler() 2. s

Re: [RFC PATCH v2 14/15] mm: Add alloc-free handshake to trigger memory region compaction

2013-04-10 Thread Cody P Schafer
On 04/09/2013 02:48 PM, Srivatsa S. Bhat wrote: We need a way to decide when to trigger the worker threads to perform region evacuation/compaction. So the strategy used is as follows: Alloc path of page allocator: This accurately tracks the allocations and detects t

[PATCH 0/4] misc patches related to resizing nodes & zones

2013-05-01 Thread Cody P Schafer
The first 3 are simply comment fixes and clarifications on locking. The last 1 adds additional locking when updating node_present_pages based on the existing documentation. Cody P Schafer (4): mmzone: make holding lock_memory_hotplug() a requirement for updating pgdat size mm: fix

[PATCH 2/4] mm: fix comment referring to non-existent size_seqlock, change to span_seqlock

2013-05-01 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 09ac172..afd0aa5 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -719,7 +719,7 @@ typedef struct

[PATCH 4/4] memory_hotplug: use pgdat_resize_lock() when updating node_present_pages

2013-05-01 Thread Cody P Schafer
mmzone.h documents node_size_lock (which pgdat_resize_lock() locks) as guarding against changes to node_present_pages, so actually lock it when we update node_present_pages to keep that promise. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 5 + 1 file changed, 5 insertions

[PATCH 3/4] mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock()

2013-05-01 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index afd0aa5..45be383 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -716,6 +716,8 @@ typedef struct pglist_data

[PATCH 1/4] mmzone: make holding lock_memory_hotplug() a requirement for updating pgdat size

2013-05-01 Thread Cody P Schafer
can't lock a mutex. Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 5c76737..09ac172 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -716,6 +716,9 @@ ty

Re: [PATCH 1/4] mmzone: make holding lock_memory_hotplug() a requirement for updating pgdat size

2013-05-01 Thread Cody P Schafer
On 05/01/2013 03:26 PM, David Rientjes wrote: On Wed, 1 May 2013, Cody P Schafer wrote: All updaters of pgdat size (spanned_pages, start_pfn, and present_pages) currently also hold lock_memory_hotplug() (in addition to pgdat_resize_lock()). Document this and make holding of that lock a

Re: [PATCH 3/4] mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock()

2013-05-01 Thread Cody P Schafer
On 05/01/2013 03:29 PM, David Rientjes wrote: On Wed, 1 May 2013, Cody P Schafer wrote: Signed-off-by: Cody P Schafer Nack, pgdat_resize_unlock() is unnecessary if irqs are known to be disabled. All this patch does is is indicate that rather than using node_size_lock directly (as it

Re: [PATCH 4/4] memory_hotplug: use pgdat_resize_lock() when updating node_present_pages

2013-05-01 Thread Cody P Schafer
On 05/01/2013 03:30 PM, David Rientjes wrote: On Wed, 1 May 2013, Cody P Schafer wrote: diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a221fac..0bdca10 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -915,6 +915,7 @@ static void node_states_set_node(int node, struct

Re: [PATCH 1/4] mmzone: make holding lock_memory_hotplug() a requirement for updating pgdat size

2013-05-01 Thread Cody P Schafer
On 05/01/2013 03:39 PM, David Rientjes wrote: On Wed, 1 May 2013, Cody P Schafer wrote: They are also initialized at boot without pgdat_resize_lock(), if we consider boot time, quite a few of the statements on when locking is required are wrong. That said, you are correct that it is not

Re: [PATCH 3/4] mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock()

2013-05-01 Thread Cody P Schafer
On 05/01/2013 03:42 PM, David Rientjes wrote: On Wed, 1 May 2013, Cody P Schafer wrote: Signed-off-by: Cody P Schafer Nack, pgdat_resize_unlock() is unnecessary if irqs are known to be disabled. All this patch does is is indicate that rather than using node_size_lock directly (as it

[PATCH] fs/binfmt_misc: avoid accidental exec disable via binfmt_misc loop

2013-05-01 Thread Cody P Schafer
right now. Signed-off-by: Cody P Schafer --- fs/binfmt_misc.c | 5 + 1 file changed, 5 insertions(+) --- If this is considered too terrible, even adding a hack to sysrq to let me recover the system (in the future) without a system reset would be appreciated. diff --git a/fs/binfmt_misc.c

Re: [PATCH 4/4] memory_hotplug: use pgdat_resize_lock() when updating node_present_pages

2013-05-01 Thread Cody P Schafer
On 05/01/2013 03:48 PM, David Rientjes wrote: On Wed, 1 May 2013, Cody P Schafer wrote: Guaranteed to be stable means that if I'm a reader and pgdat_resize_lock(), node_present_pages had better not change at all until I pgdat_resize_unlock(). If nothing needs this guarantee, we should c

[PATCH v2 0/4] misc patches related to resizing nodes & zones

2013-05-01 Thread Cody P Schafer
() (rientjes) - make comment regarding pgdat_resize_lock()/unlock() usage more clear (rientjes) -- Cody P Schafer (4): mm: fix comment referring to non-existent size_seqlock, change to span_seqlock mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock

[PATCH v2 3/4] memory_hotplug: use pgdat_resize_lock() in online_pages()

2013-05-01 Thread Cody P Schafer
mmzone.h documents node_size_lock (which pgdat_resize_lock() locks) as guarding against changes to node_present_pages, so actually lock it when we update node_present_pages to keep that promise. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 5 + 1 file changed, 5 insertions

[PATCH v2 4/4] memory_hotplug: use pgdat_resize_lock() in __offline_pages()

2013-05-01 Thread Cody P Schafer
mmzone.h documents node_size_lock (which pgdat_resize_lock() locks) as guarding against changes to node_present_pages, so actually lock it when we update node_present_pages to keep that promise. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 4 1 file changed, 4 insertions

[PATCH v2 2/4] mmzone: note that node_size_lock should be manipulated via pgdat_resize_lock()

2013-05-01 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index fc859a0c..41557be 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -716,6 +716,9 @@ typedef struct pglist_data

[PATCH v2 1/4] mm: fix comment referring to non-existent size_seqlock, change to span_seqlock

2013-05-01 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 5c76737..fc859a0c 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -716,7 +716,7 @@ typedef struct

Re: [PATCH v3 00/11] mm: fixup changers of per cpu pageset's ->high and ->batch

2013-05-01 Thread Cody P Schafer
On 04/10/2013 02:25 PM, Cody P Schafer wrote: On 04/10/2013 02:23 PM, Andrew Morton wrote: On Wed, 10 Apr 2013 11:23:28 -0700 Cody P Schafer wrote: "Problems" with the current code: 1. there is a lack of synchronization in setting ->high a

[RFC PATCH v3 00/31] Dynamic NUMA: Runtime NUMA memory layout reconfiguration

2013-05-02 Thread Cody P Schafer
s refresh code - remove holes for memlayouts to make iteration over them less of a chore. Since v1: http://comments.gmane.org/gmane.linux.kernel.mm/95541 - Update watermarks. - Update zone percpu pageset ->batch & ->high only when needed. - Don't lazily adjust {pgdat,zone}->{present_pag

[RFC PATCH v3 03/31] mm/memory_hotplug: factor out zone+pgdat growth.

2013-05-02 Thread Cody P Schafer
Create a new function grow_pgdat_and_zone() which handles locking + growth of a zone & the pgdat which it is associated with. Signed-off-by: Cody P Schafer --- include/linux/memory_hotplug.h | 3 +++ mm/memory_hotplug.c| 17 +++-- 2 files changed, 14 insertions(+

[RFC PATCH v3 14/31] mm: memlayout+dnuma: add debugfs interface

2013-05-02 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/dnuma.h | 2 +- include/linux/memlayout.h | 7 + mm/Kconfig| 30 mm/Makefile | 1 + mm/dnuma.c| 4 +- mm/memlayout-debugfs.c| 339 ++

[RFC PATCH v3 21/31] page_alloc: use dnuma to transplant newly freed pages in free_hot_cold_page()

2013-05-02 Thread Cody P Schafer
s are skipped & the page is freed via free_one_page(). Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f33f1bf..38a2161 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1358,6 +1358,

[RFC PATCH v3 18/31] drivers/base/node: add unregister_mem_block_under_nodes()

2013-05-02 Thread Cody P Schafer
Provides similar functionality to unregister_mem_block_section_under_nodes() (which was previously named identically to the newly added funtion), but operates on all memory sections included in the memory block, not just the specified one. --- drivers/base/node.c | 53

[RFC PATCH v3 11/31] page-flags dnuma: reserve a pageflag for determining if a page needs a node lookup.

2013-05-02 Thread Cody P Schafer
eeds to be avoided. Signed-off-by: Cody P Schafer --- include/linux/page-flags.h | 19 +++ mm/page_alloc.c| 3 +++ 2 files changed, 22 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6d53675..09dd94e 100644 --- a/include/

[RFC PATCH v3 22/31] page_alloc: transplant pages that are being flushed from the per-cpu lists

2013-05-02 Thread Cody P Schafer
In free_pcppages_bulk(), check if a page needs to be moved to a new node/zone & then perform the transplant (in a slightly defered manner). Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --g

[RFC PATCH v3 20/31] page_alloc: use dnuma to transplant newly freed pages in __free_pages_ok()

2013-05-02 Thread Cody P Schafer
__free_pages_ok() handles higher order (order != 0) pages. Transplant hook is added here as this is where the struct zone to free to is decided. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b

[RFC PATCH v3 15/31] drivers/base/memory.c: alphabetize headers.

2013-05-02 Thread Cody P Schafer
--- drivers/base/memory.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 14f8a69..5247698 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -10,20 +10,20 @@ * SPARSEMEM should be contained here,

[RFC PATCH v3 02/31] rbtree: add rbtree_postorder_for_each_entry_safe() helper.

2013-05-02 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/rbtree.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 2879e96..1b239ca 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h @@ -85,4 +85,12 @@ static inline void

[RFC PATCH v3 16/31] drivers/base/node,memory: rename function to match interface

2013-05-02 Thread Cody P Schafer
Rename register_mem_sect_under_node() to register_mem_block_under_node() and rename unregister_mem_sect_under_nodes() to unregister_mem_block_under_nodes() to reflect that both of these functions are given memory_blocks instead of mem_sections --- drivers/base/memory.c | 4 ++-- drivers/base/n

[RFC PATCH v3 13/31] mm: add memlayout & dnuma to track pfn->nid & transplant pages between nodes

2013-05-02 Thread Cody P Schafer
to actually perform the "transplant on free" are in later patches. Signed-off-by: Cody P Schafer --- include/linux/dnuma.h | 97 +++ include/linux/memlayout.h | 127 ++ mm/Makefile | 1 + mm/dnuma.c| 430 +++

[RFC PATCH v3 17/31] drivers/base/node: rename unregister_mem_blk_under_nodes() to be more acurate

2013-05-02 Thread Cody P Schafer
unregister_mem_block_under_nodes() only unregisters a single section in the mem block under all nodes, not the entire mem block. Rename it to unregister_mem_block_section_under_nodes(). Also rename the phys_index param to indicate that it is a section number. --- drivers/base/memory.c | 2 +- dri

[RFC PATCH v3 19/31] mm: memory,memlayout: add refresh_memory_blocks() for Dynamic NUMA.

2013-05-02 Thread Cody P Schafer
Properly update the sysfs info when memory blocks move between nodes due to a Dynamic NUMA reconfiguration. --- drivers/base/memory.c | 39 +++ include/linux/memory.h | 5 + mm/memlayout.c | 3 +++ 3 files changed, 47 insertions(+) diff --git a/d

[RFC PATCH v3 07/31] mm: Add Dynamic NUMA Kconfig.

2013-05-02 Thread Cody P Schafer
We need to add some functionality for use by Dynamic NUMA to pieces of mm/, so provide the Kconfig prior to adding actual Dynamic NUMA functionality. For details on Dynamic NUMA, see te later patch (which adds baseline functionality): "mm: add memlayout & dnuma to track pfn->nid & transplant page

[RFC PATCH v3 08/31] page_alloc: add return_pages_to_zone() when DYNAMIC_NUMA is enabled.

2013-05-02 Thread Cody P Schafer
Add return_pages_to_zone(), which uses return_page_to_zone(). It is a minimized version of __free_pages_ok() which handles adding pages which have been removed from another zone into a new zone. Signed-off-by: Cody P Schafer --- mm/internal.h | 5 - mm/page_alloc.c | 17

[RFC PATCH v3 12/31] memory_hotplug: factor out locks in mem_online_cpu()

2013-05-02 Thread Cody P Schafer
In dynamic numa, when onlining nodes, lock_memory_hotplug() is already held when mem_online_node()'s functionality is needed. Factor out the locking and create a new function __mem_online_node() to allow reuse. Signed-off-by: Cody P Schafer --- include/linux/memory_hotplug.h | 1

[RFC PATCH v3 31/31] mm: add a early_param "extra_nr_node_ids" to increase nr_node_ids above the minimum by a percentage.

2013-05-02 Thread Cody P Schafer
vided by the hypervisor. This option allows reserving some extra node ids as a percentage of the boot time node ids. While not perfect (idealy nr_node_ids would be fully dynamic), this allows decent functionality without invasive changes to the SL{U,A}B allocators. Signed-off-by: Cody P Sc

[RFC PATCH v3 29/31] mm/page_alloc: make pr_err() in page_outside_zone_boundaries() more useful

2013-05-02 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3695ca5..4fe35b24 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -254,8 +254,11 @@ static int page_outside_zone_boundaries

[RFC PATCH v3 30/31] mm/page_alloc: use manage_pages instead of present pages when calculating default_zonelist_order()

2013-05-02 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4fe35b24..cc7b332 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3514,8 +3514,8 @@ static int default_zonelist_order(void

[RFC PATCH v3 05/31] mm/memory_hotplug: use {pgdat,zone}_is_empty() when resizing zones & pgdats

2013-05-02 Thread Cody P Schafer
Use the *_is_empty() helpers to be more clear about what we're actually checking for. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index f4cb01a..a65235f 100644 ---

[RFC PATCH v3 09/31] page_alloc: in move_freepages(), skip pages instead of VM_BUG on node differences.

2013-05-02 Thread Cody P Schafer
moves the VM_BUG_ON() (which detects a change in node) so that it follows the pfn_valid_within() check. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 739b405..657f773

[RFC PATCH v3 28/31] mm/page_alloc: in page_outside_zone_boundaries(), avoid premature decisions.

2013-05-02 Thread Cody P Schafer
As there will be no pages in the exsess span that actually belong to the zone being manipulated, I don't expect there to be issues. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c

[RFC PATCH v3 27/31] mm/memory_hotplug: VM_BUG if nid is too large.

2013-05-02 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 8e6658d..320d914 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1071,6 +1071,8 @@ int __mem_online_node(int nid

[RFC PATCH v3 01/31] rbtree: add postorder iteration functions.

2013-05-02 Thread Cody P Schafer
Add postorder iteration functions for rbtree. These are useful for safely freeing an entire rbtree without modifying the tree at all. Signed-off-by: Cody P Schafer --- include/linux/rbtree.h | 4 lib/rbtree.c | 40 2 files changed, 44

[RFC PATCH v3 06/31] mm: add nid_zone() helper

2013-05-02 Thread Cody P Schafer
Add nid_zone(), which returns the zone corresponding to a given nid & zonenum. Signed-off-by: Cody P Schafer --- include/linux/mm.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 1a7f19e..2004713 100644 --- a/include/l

[RFC PATCH v3 25/31] dnuma: memlayout: add memory_add_physaddr_to_nid() for memory_hotplug

2013-05-02 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/memlayout.c | 16 1 file changed, 16 insertions(+) diff --git a/mm/memlayout.c b/mm/memlayout.c index 8b9ba9a..3e89482 100644 --- a/mm/memlayout.c +++ b/mm/memlayout.c @@ -336,3 +336,19 @@ void memlayout_global_init(void

[RFC PATCH v3 26/31] x86/mm/numa: when dnuma is enabled, use memlayout to handle memory hotplug's physaddr_to_nid.

2013-05-02 Thread Cody P Schafer
When a memlayout is tracked (ie: CONFIG_DYNAMIC_NUMA is enabled), rather than iterate over numa_meminfo, a lookup can be done using memlayout. Signed-off-by: Cody P Schafer --- arch/x86/mm/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch

[RFC PATCH v3 24/31] init/main: call memlayout_global_init() in start_kernel().

2013-05-02 Thread Cody P Schafer
memlayout_global_init() initializes the first memlayout, which is assumed to match the initial page-flag nid settings. This is done in start_kernel() as the initdata used to populate the memlayout is purged from memory early in the boot process (XXX: When?). Signed-off-by: Cody P Schafer

[RFC PATCH v3 23/31] x86: memlayout: add a arch specific inital memlayout setter.

2013-05-02 Thread Cody P Schafer
On x86, we have numa_info specifically to track the numa layout, which is precisely the data memlayout needs, so use it to create an initial memlayout. Signed-off-by: Cody P Schafer --- arch/x86/mm/numa.c | 28 1 file changed, 28 insertions(+) diff --git a/arch/x86

[RFC PATCH v3 04/31] memory_hotplug: export ensure_zone_is_initialized() in mm/internal.h

2013-05-02 Thread Cody P Schafer
Export ensure_zone_is_initialized() so that it can be used to initialize new zones within the dynamic numa code. Signed-off-by: Cody P Schafer --- mm/internal.h | 8 mm/memory_hotplug.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/internal.h b/mm

[RFC PATCH v3 10/31] page_alloc: when dynamic numa is enabled, don't check that all pages in a block belong to the same zone

2013-05-02 Thread Cody P Schafer
be skipped. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 657f773..9de55a2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -960,13 +960,16 @@ int move_freepages

Re: [PATCH v5, part4 20/41] mm/h8300: prepare for removing num_physpages and simplify mem_init()

2013-05-08 Thread Cody P Schafer
On 05/08/2013 12:29 PM, Sergei Shtylyov wrote: Although, not necessarily: it also supports CONFIG_DYNAMIC_DEBUG -- look at how pr_debug() is defined. So this doesn't seem to be an equivalent change, and I suggest not doing it at all. WBR, Sergei pr_devel() should get the same behavior: n

[PATCH] mm/vmstat: add note on safety of drain_zonestat

2013-04-11 Thread Cody P Schafer
--- mm/vmstat.c | 4 1 file changed, 4 insertions(+) diff --git a/mm/vmstat.c b/mm/vmstat.c index e1d8ed1..2b93877 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -495,6 +495,10 @@ void refresh_cpu_vm_stats(int cpu) atomic_long_add(global_diff[i], &vm_stat[i]); } +/*

[RFC PATCH v2 08/25] page_alloc: in move_freepages(), skip pages instead of VM_BUG on node differences.

2013-04-11 Thread Cody P Schafer
moves the VM_BUG_ON() (which detects a change in node) so that it follows the pfn_valid_within() check. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 1fbf5f2..75192eb

[RFC PATCH v2 11/25] memory_hotplug: factor out locks in mem_online_cpu()

2013-04-11 Thread Cody P Schafer
In dynamic numa, when onlining nodes, lock_memory_hotplug() is already held when mem_online_node()'s functionality is needed. Factor out the locking and create a new function __mem_online_node() to allow reuse. Signed-off-by: Cody P Schafer --- include/linux/memory_hotplug.h | 1

[RFC PATCH v2 12/25] mm: add memlayout & dnuma to track pfn->nid & transplant pages between nodes

2013-04-11 Thread Cody P Schafer
to actually perform the "transplant on free" are in later patches. Signed-off-by: Cody P Schafer --- include/linux/dnuma.h | 97 ++ include/linux/memlayout.h | 126 + mm/Kconfig| 24 +++ mm/Makefile | 1 + mm/dnuma.c

[RFC PATCH v2 22/25] mm/page_alloc: in page_outside_zone_boundaries(), avoid premature decisions.

2013-04-11 Thread Cody P Schafer
As there will be no pages in the exsess span that actually belong to the zone being manipulated, I don't expect there to be issues. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c

[RFC PATCH v2 25/25] mm: add a early_param "extra_nr_node_ids" to increase nr_node_ids above the minimum by a percentage.

2013-04-11 Thread Cody P Schafer
vided by the hypervisor. This option allows reserving some extra node ids as a percentage of the boot time node ids. While not perfect (idealy nr_node_ids would be fully dynamic), this allows decent functionality without invasive changes to the SL{U,A}B allocators. Signed-off-by: Cody P Sc

[RFC PATCH v2 18/25] init/main: call memlayout_global_init() in start_kernel().

2013-04-11 Thread Cody P Schafer
memlayout_global_init() initializes the first memlayout, which is assumed to match the initial page-flag nid settings. This is done in start_kernel() as the initdata used to populate the memlayout is purged from memory early in the boot process (XXX: When?). Signed-off-by: Cody P Schafer

[RFC PATCH v2 24/25] mm/page_alloc: use manage_pages instead of present pages when calculating default_zonelist_order()

2013-04-11 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 20304cb..686d8f8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3488,8 +3488,8 @@ static int default_zonelist_order(void

[RFC PATCH v2 23/25] mm/page_alloc: make pr_err() in page_outside_zone_boundaries() more useful

2013-04-11 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a54baa9..20304cb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -253,8 +253,11 @@ static int page_outside_zone_boundaries

[RFC PATCH v2 21/25] mm/memory_hotplug: VM_BUG if nid is too large.

2013-04-11 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index f5ea9b7..5fcd29e 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1063,6 +1063,8 @@ int __mem_online_node(int nid

[RFC PATCH v2 20/25] x86/mm/numa: when dnuma is enabled, use memlayout to handle memory hotplug's physaddr_to_nid.

2013-04-11 Thread Cody P Schafer
When a memlayout is tracked (ie: CONFIG_DYNAMIC_NUMA is enabled), rather than iterate over numa_meminfo, a lookup can be done using memlayout. Signed-off-by: Cody P Schafer --- arch/x86/mm/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch

[RFC PATCH v2 14/25] page_alloc: use dnuma to transplant newly freed pages in __free_pages_ok()

2013-04-11 Thread Cody P Schafer
__free_pages_ok() handles higher order (order != 0) pages. Transplant hook is added here as this is where the struct zone to free to is decided. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b

[RFC PATCH v2 19/25] dnuma: memlayout: add memory_add_physaddr_to_nid() for memory_hotplug

2013-04-11 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- mm/memlayout.c | 16 1 file changed, 16 insertions(+) diff --git a/mm/memlayout.c b/mm/memlayout.c index 45e7df6..4dc6706 100644 --- a/mm/memlayout.c +++ b/mm/memlayout.c @@ -247,3 +247,19 @@ void memlayout_global_init(void

[RFC PATCH v2 16/25] page_alloc: transplant pages that are being flushed from the per-cpu lists

2013-04-11 Thread Cody P Schafer
In free_pcppages_bulk(), check if a page needs to be moved to a new node/zone & then perform the transplant (in a slightly defered manner). Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --g

[RFC PATCH v2 17/25] x86: memlayout: add a arch specific inital memlayout setter.

2013-04-11 Thread Cody P Schafer
On x86, we have numa_info specifically to track the numa layout, which is precisely the data memlayout needs, so use it to create an initial memlayout. Signed-off-by: Cody P Schafer --- arch/x86/mm/numa.c | 28 1 file changed, 28 insertions(+) diff --git a/arch/x86

[RFC PATCH v2 13/25] mm: memlayout+dnuma: add debugfs interface

2013-04-11 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/dnuma.h | 2 +- include/linux/memlayout.h | 7 + mm/Kconfig| 30 mm/Makefile | 1 + mm/dnuma.c| 4 +- mm/memlayout-debugfs.c| 339 ++

[RFC PATCH v2 15/25] page_alloc: use dnuma to transplant newly freed pages in free_hot_cold_page()

2013-04-11 Thread Cody P Schafer
s are skipped & the page is freed via free_one_page(). Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index f8ae178..98ac7c6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1357,6 +1357,

[RFC PATCH v2 09/25] page_alloc: when dynamic numa is enabled, don't check that all pages in a block belong to the same zone

2013-04-11 Thread Cody P Schafer
be skipped. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 75192eb..95e4a23 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -959,13 +959,16 @@ int move_freepages

[RFC PATCH v2 06/25] mm: add nid_zone() helper

2013-04-11 Thread Cody P Schafer
Add nid_zone(), which returns the zone corresponding to a given nid & zonenum. Signed-off-by: Cody P Schafer --- include/linux/mm.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9ddae00..1b6abae 100644 --- a/include/l

[RFC PATCH v2 10/25] page-flags dnuma: reserve a pageflag for determining if a page needs a node lookup.

2013-04-11 Thread Cody P Schafer
eeds to be avoided. Signed-off-by: Cody P Schafer --- include/linux/page-flags.h | 19 +++ mm/page_alloc.c| 3 +++ 2 files changed, 22 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6d53675..09dd94e 100644 --- a/include/

[RFC PATCH v2 07/25] page_alloc: add return_pages_to_zone() when DYNAMIC_NUMA is enabled.

2013-04-11 Thread Cody P Schafer
Add return_pages_to_zone(), which uses return_page_to_zone(). It is a minimized version of __free_pages_ok() which handles adding pages which have been removed from another zone into a new zone. Signed-off-by: Cody P Schafer --- mm/internal.h | 5 - mm/page_alloc.c | 17

[RFC PATCH v2 01/25] rbtree: add postorder iteration functions.

2013-04-11 Thread Cody P Schafer
Add postorder iteration functions for rbtree. These are useful for safely freeing an entire rbtree without modifying the tree at all. Signed-off-by: Cody P Schafer --- include/linux/rbtree.h | 4 lib/rbtree.c | 40 2 files changed, 44

[RFC PATCH v2 03/25] mm/memory_hotplug: factor out zone+pgdat growth.

2013-04-11 Thread Cody P Schafer
Create a new function grow_pgdat_and_zone() which handles locking + growth of a zone & the pgdat which it is associated with. Signed-off-by: Cody P Schafer --- include/linux/memory_hotplug.h | 3 +++ mm/memory_hotplug.c| 17 +++-- 2 files changed, 14 insertions(+

[RFC PATCH v2 04/25] memory_hotplug: export ensure_zone_is_initialized() in mm/internal.h

2013-04-11 Thread Cody P Schafer
Export ensure_zone_is_initialized() so that it can be used to initialize new zones within the dynamic numa code. Signed-off-by: Cody P Schafer --- mm/internal.h | 8 mm/memory_hotplug.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mm/internal.h b/mm

[RFC PATCH v2 05/25] mm/memory_hotplug: use {pgdat,zone}_is_empty() when resizing zones & pgdats

2013-04-11 Thread Cody P Schafer
Use the *_is_empty() helpers to be more clear about what we're actually checking for. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index df04c36..deea8c2 100644 ---

[RFC PATCH v2 02/25] rbtree: add rbtree_postorder_for_each_entry_safe() helper.

2013-04-11 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- include/linux/rbtree.h | 8 1 file changed, 8 insertions(+) diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index 2879e96..1b239ca 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h @@ -85,4 +85,12 @@ static inline void

[RFC PATCH v2 00/25] Dynamic NUMA: Runtime NUMA memory layout reconfiguration

2013-04-11 Thread Cody P Schafer
potentially) propagation of updated layout knowledge into kmem_caches (SL*B). -- Since v1: http://comments.gmane.org/gmane.linux.kernel.mm/95541 - Update watermarks. - Update zone percpu pageset ->batch & ->high only when needed. - Don't lazily adjust {pgdat,zone}->{present_pag

Re: [BUG] NTFS code doesn't sanitize folder names sufficiently

2012-08-01 Thread Cody P Schafer
The solution to this would be to disallow creation of files and folders on NTFS drives containing illegal characters. Illegal characters with respect to Windows & the like are different from Illegal characters with respect to the NTFS filesystem structure. Looking at ntfs-3g(8) [yes, I'm aw

Re: [PATCHv2 6/6] media: Convert struct i2c_msg initialization to C99 format

2012-09-18 Thread Cody P Schafer
On Tue 18 Sep 2012 03:02:42 AM PDT, Venu Byravarasu wrote: -Original Message- From: Shubhrajyoti Datta [mailto:omaplinuxker...@gmail.com] Sent: Tuesday, September 18, 2012 3:30 PM To: Venu Byravarasu Cc: Shubhrajyoti D; linux-me...@vger.kernel.org; linux- ker...@vger.kernel.org; julia.law

[PATCH 01/16] perf symbol: correct comment wrt kallsyms loading

2012-08-09 Thread Cody P Schafer
y, start & end define an inclusive range. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 07e7bd6..df4736d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/

[PATCH 05/16] perf symbol: don't try to synthesize plt without dynstr.

2012-08-09 Thread Cody P Schafer
If .dynsym exists but .dynstr is empty (NO_BITS or size==0), a segfault occurs. Avoid this by checking that .dynstr is not empty. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c

[PATCH 10/16] perf symbol: track symtab_type of vmlinux

2012-08-09 Thread Cody P Schafer
Previously, symtab_type would have been left at 0, or KALLSYMS, which is not quite accurate. Introduce DSO_SYMTAB_TYPE__VMLINUX[_GUEST]. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 9 + tools/perf/util/symbol.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a

[PATCH 15/16] perf symbol: convert dso__load_syms to take 2 symsrc's

2012-08-09 Thread Cody P Schafer
exists in the runtime image) is the same in both the runtime and debug/symbols image. Both of these are true on RHEL, but it is unclear how accurate they are in general (on platforms with function descriptors in opd sections). Signed-off-by: Cody P Schafer --- tools/perf/util

[PATCH 04/16] perf utils: remove unused function map__objdump_2ip

2012-08-09 Thread Cody P Schafer
map__objdump_2ip was introduced in: ee11b90b12 perf top: Fix annotate for userspace And it's last user removed in: 36532461a0 perf top: Ditch private annotation code, share perf annotate's Remove it. Signed-off-by: Cody P Schafer --- tools/perf/util/map.c | 8 tools/perf/

[PATCH 11/16] perf symbol: introduce symsrc structure.

2012-08-09 Thread Cody P Schafer
duplicate code for looking up the same sections and checking for the existence of an important section wouldn't be as clean. Additionally, move dso__swap_init() so we can use it. Utilized by the later patch "perf symbol: use both runtime and debug images" Signed-off-by: Cody P Schaf

[PATCH 07/16] perf symbol: symplify out_fixup in kernel syms loading

2012-08-09 Thread Cody P Schafer
The only site that jumps to out_fixup has (kallsyms_filename == NULL). And all paths that reach 'if (err > 0)' without 'goto out_fixup' have kallsyms_filename != NULL. So skip over both the check & dso__set_long_name(), and remove the check. Signed-off-by: Cody P Sc

[PATCH 0/16] perf: various symbol resolution fixes, including .opd section use.

2012-08-09 Thread Cody P Schafer
1-4,6,7 are small cleanups. 5 fixes a potential segfault. 8 fixes a use after free for dso->long_name 9 avoids a segfault in elfutils when a truncated elf is loaded. 10 properly tracks that a dso had symbols loaded from a vmlinux image 11-16 fix handling of the '.opd' section in the presence o

<    1   2   3   4   5   >