Re: [performance regression, bisected] scheduler: should_we_balance() kills filesystem performance

2013-09-10 Thread Joonsoo Kim
On Tue, Sep 10, 2013 at 04:15:20PM +1000, Dave Chinner wrote: On Tue, Sep 10, 2013 at 01:47:59PM +0900, Joonsoo Kim wrote: On Tue, Sep 10, 2013 at 02:02:54PM +1000, Dave Chinner wrote: Hi folks, I just updated my performance test VM to the current 3.12-git tree after the XFS dev

Re: [PATCH 01/50] sched: monolithic code dump of what is being pushed upstream

2013-09-10 Thread Joonsoo Kim
On Tue, Sep 10, 2013 at 10:31:41AM +0100, Mel Gorman wrote: @@ -5045,15 +5038,50 @@ static int need_active_balance(struct lb_env *env) static int active_load_balance_cpu_stop(void *data); +static int should_we_balance(struct lb_env *env) +{ + struct sched_group *sg = env-sd-groups;

Re: [REPOST PATCH 3/4] slab: introduce byte sized index for the freelist of a slab

2013-09-10 Thread Joonsoo Kim
On Tue, Sep 10, 2013 at 09:25:05PM +, Christoph Lameter wrote: On Tue, 10 Sep 2013, Joonsoo Kim wrote: On Mon, Sep 09, 2013 at 02:44:03PM +, Christoph Lameter wrote: On Mon, 9 Sep 2013, Joonsoo Kim wrote: 32 byte is not minimum object size, minimum *kmalloc* object size

Re: [PATCH 01/16] slab: correct pfmemalloc check

2013-09-12 Thread Joonsoo Kim
On Wed, Sep 11, 2013 at 02:30:03PM +, Christoph Lameter wrote: On Thu, 22 Aug 2013, Joonsoo Kim wrote: And, therefore we should check pfmemalloc in page flag of first page, but current implementation don't do that. virt_to_head_page(obj) just return 'struct page' of that object

Re: [REPOST PATCH 3/4] slab: introduce byte sized index for the freelist of a slab

2013-09-12 Thread Joonsoo Kim
On Wed, Sep 11, 2013 at 02:22:25PM +, Christoph Lameter wrote: On Wed, 11 Sep 2013, Joonsoo Kim wrote: Anyway, could you review my previous patchset, that is, 'overload struct slab over struct page to reduce memory usage'? I'm not sure whether your answer is ack or not. I

Re: [PATCH 07/16] slab: overloading the RCU head over the LRU for RCU free

2013-09-12 Thread Joonsoo Kim
On Wed, Sep 11, 2013 at 02:39:22PM +, Christoph Lameter wrote: On Thu, 22 Aug 2013, Joonsoo Kim wrote: With build-time size checking, we can overload the RCU head over the LRU of struct page to free pages of a slab in rcu context. This really help to implement to overload the struct

Re: [PATCH 01/18] mm, hugetlb: protect reserved pages when softofflining requests the pages

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 03:24:46PM +0800, Hillf Danton wrote: On Mon, Jul 29, 2013 at 1:31 PM, Joonsoo Kim iamjoonsoo@lge.com wrote: alloc_huge_page_node() use dequeue_huge_page_node() without any validation check, so it can steal reserved page unconditionally. Well, why is it illegal

Re: [PATCH 03/18] mm, hugetlb: unify region structure handling

2013-07-30 Thread Joonsoo Kim
On Tue, Jul 30, 2013 at 10:57:37PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: Currently, to track a reserved and allocated region, we use two different ways for MAP_SHARED and MAP_PRIVATE. For MAP_SHARED, we use address_mapping's private_list

Re: [PATCH 05/18] mm, hugetlb: protect region tracking via newly introduced resv_map lock

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 04:58:57PM +0800, Hillf Danton wrote: On Mon, Jul 29, 2013 at 1:31 PM, Joonsoo Kim iamjoonsoo@lge.com wrote: There is a race condition if we map a same file on different processes. Region tracking is protected by mmap_sem and hugetlb_instantiation_mutex. When we

Re: [PATCH 05/18] mm, hugetlb: protect region tracking via newly introduced resv_map lock

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 11:53:05AM -0700, Davidlohr Bueso wrote: On Mon, 2013-07-29 at 14:31 +0900, Joonsoo Kim wrote: There is a race condition if we map a same file on different processes. Region tracking is protected by mmap_sem and hugetlb_instantiation_mutex. When we do mmap, we don't

Re: [PATCH 01/18] mm, hugetlb: protect reserved pages when softofflining requests the pages

2013-07-30 Thread Joonsoo Kim
On Wed, Jul 31, 2013 at 10:49:24AM +0800, Hillf Danton wrote: On Wed, Jul 31, 2013 at 10:27 AM, Joonsoo Kim iamjoonsoo@lge.com wrote: On Mon, Jul 29, 2013 at 03:24:46PM +0800, Hillf Danton wrote: On Mon, Jul 29, 2013 at 1:31 PM, Joonsoo Kim iamjoonsoo@lge.com wrote

Re: [PATCH 06/18] mm, hugetlb: remove vma_need_reservation()

2013-07-30 Thread Joonsoo Kim
Hello, Naoya. On Mon, Jul 29, 2013 at 01:52:52PM -0400, Naoya Horiguchi wrote: Hi, On Mon, Jul 29, 2013 at 02:31:57PM +0900, Joonsoo Kim wrote: vma_need_reservation() can be substituted by vma_has_reserves() with minor change. These function do almost same thing, so unifying them

Re: [PATCH 06/18] mm, hugetlb: remove vma_need_reservation()

2013-07-30 Thread Joonsoo Kim
On Tue, Jul 30, 2013 at 11:19:58PM +0530, Aneesh Kumar K.V wrote: Joonsoo Kim iamjoonsoo@lge.com writes: vma_need_reservation() can be substituted by vma_has_reserves() with minor change. These function do almost same thing, so unifying them is better to maintain. I found

Re: [PATCH 08/18] mm, hugetlb: do hugepage_subpool_get_pages() when avoid_reserve

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 02:05:51PM -0400, Naoya Horiguchi wrote: On Mon, Jul 29, 2013 at 02:31:59PM +0900, Joonsoo Kim wrote: When we try to get a huge page with avoid_reserve, we don't consume a reserved page. So it is treated like as non-reserve case. This patch will be completely

Re: [PATCH 10/18] mm, hugetlb: call vma_has_reserve() before entering alloc_huge_page()

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 02:27:54PM -0400, Naoya Horiguchi wrote: On Mon, Jul 29, 2013 at 02:32:01PM +0900, Joonsoo Kim wrote: To implement a graceful failure handling, we need to know whether allocation request is for reserved pool or not, on higher level. In this patch, we just move up

Re: [PATCH 11/18] mm, hugetlb: move down outside_reserve check

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 02:39:30PM -0400, Naoya Horiguchi wrote: On Mon, Jul 29, 2013 at 02:32:02PM +0900, Joonsoo Kim wrote: Just move down outsider_reserve check. This makes code more readable. There is no functional change. Why don't you do this in 10/18? Just help to review

Re: [PATCH 15/18] mm, hugetlb: move up anon_vma_prepare()

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 03:19:15PM -0400, Naoya Horiguchi wrote: On Mon, Jul 29, 2013 at 03:05:37PM -0400, Naoya Horiguchi wrote: On Mon, Jul 29, 2013 at 02:32:06PM +0900, Joonsoo Kim wrote: If we fail with a allocated hugepage, it is hard to recover properly. One such example is reserve

Re: [PATCH 16/18] mm, hugetlb: return a reserved page to a reserved pool if failed

2013-07-30 Thread Joonsoo Kim
On Mon, Jul 29, 2013 at 04:19:10PM -0400, Naoya Horiguchi wrote: On Mon, Jul 29, 2013 at 02:32:07PM +0900, Joonsoo Kim wrote: If we fail with a reserved page, just calling put_page() is not sufficient, because put_page() invoke free_huge_page() at last step and it doesn't know whether

Re: [PATCH 17/18] mm, hugetlb: retry if we fail to allocate a hugepage with use_reserve

2013-07-30 Thread Joonsoo Kim
Hello, David. On Mon, Jul 29, 2013 at 05:28:23PM +1000, David Gibson wrote: On Mon, Jul 29, 2013 at 02:32:08PM +0900, Joonsoo Kim wrote: If parallel fault occur, we can fail to allocate a hugepage, because many threads dequeue a hugepage to handle a fault of same address. This makes

Re: [PATCH v3 6/9] mm, hugetlb: do not use a page in page cache for cow optimization

2013-07-30 Thread Joonsoo Kim
On Tue, Jul 30, 2013 at 08:37:08AM +1000, David Gibson wrote: On Mon, Jul 29, 2013 at 02:28:18PM +0900, Joonsoo Kim wrote: Currently, we use a page with mapped count 1 in page cache for cow optimization. If we find this condition, we don't allocate a new page and copy contents. Instead, we

Re: [PATCH 01/18] mm, hugetlb: protect reserved pages when softofflining requests the pages

2013-07-31 Thread Joonsoo Kim
On Wed, Jul 31, 2013 at 02:21:38PM +0800, Hillf Danton wrote: On Wed, Jul 31, 2013 at 12:41 PM, Joonsoo Kim iamjoonsoo@lge.com wrote: On Wed, Jul 31, 2013 at 10:49:24AM +0800, Hillf Danton wrote: On Wed, Jul 31, 2013 at 10:27 AM, Joonsoo Kim iamjoonsoo@lge.com wrote: On Mon, Jul

Re: [PATCH 01/18] mm, hugetlb: protect reserved pages when softofflining requests the pages

2013-08-01 Thread Joonsoo Kim
On Wed, Jul 31, 2013 at 11:25:04PM +0800, Hillf Danton wrote: On Wed, Jul 31, 2013 at 2:37 PM, Joonsoo Kim iamjoonsoo@lge.com wrote: On Wed, Jul 31, 2013 at 02:21:38PM +0800, Hillf Danton wrote: On Wed, Jul 31, 2013 at 12:41 PM, Joonsoo Kim iamjoonsoo@lge.com wrote: On Wed, Jul

[PATCH v2 2/3] sched: factor out code to should_we_balance()

2013-08-01 Thread Joonsoo Kim
354958aa7 kernel/sched/fair.o In addition, rename @balance to @should_balance in order to represent its purpose more clearly. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index eaae77e..7f51b8c 100644 --- a/kernel/sched/fair.c +++ b

[PATCH v2 3/3] sched: clean-up struct sd_lb_stat

2013-08-01 Thread Joonsoo Kim
-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7f51b8c..f72ee7d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4195,36 +4195,6 @@ static unsigned long task_h_load(struct task_struct *p) /** Helpers for find_busiest_group

[PATCH v2 1/3] sched: remove one division operation in find_buiest_queue()

2013-08-01 Thread Joonsoo Kim
Remove one division operation in find_buiest_queue(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c61a614..eaae77e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4931,7 +4931,7 @@ static struct rq

[PATCH v2 0/3] optimization, clean-up about fair.c

2013-08-01 Thread Joonsoo Kim
be compiled properly. * Change from v1 Remove 2 patches, because I cannot sure they are right. Joonsoo Kim (3): sched: remove one division operation in find_buiest_queue() sched: factor out code to should_we_balance() sched: clean-up struct sd_lb_stat kernel/sched/fair.c | 326

[PATCH 1/2] mm, vmalloc: remove useless variable in vmap_block

2013-08-01 Thread Joonsoo Kim
vbq in vmap_block isn't used. So remove it. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 13a5495..d23c432 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -752,7 +752,6 @@ struct vmap_block_queue { struct vmap_block { spinlock_t lock

[PATCH 2/2] mm, vmalloc: use well-defined find_last_bit() func

2013-08-01 Thread Joonsoo Kim
Our intention in here is to find last_bit within the region to flush. There is well-defined function, find_last_bit() for this purpose and it's performance may be slightly better than current implementation. So change it. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm

[PATCH] mm, slab_common: add 'unlikely' to size check of kmalloc_slab()

2013-08-01 Thread Joonsoo Kim
Size is usually below than KMALLOC_MAX_SIZE. If we add a 'unlikely' macro, compiler can make better code. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab_common.c b/mm/slab_common.c index 538bade..f0410eb 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -373,7

[PATCH 4/4] swap: clean-up #ifdef in page_mapping()

2013-08-01 Thread Joonsoo Kim
PageSwapCache() is always false when !CONFIG_SWAP, so compiler properly discard related code. Therefore, we don't need #ifdef explicitly. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/swap.h b/include/linux/swap.h index d95cde5..c638a71 100644 --- a/include/linux

[PATCH 3/4] mm: move pgtable related functions to right place

2013-08-01 Thread Joonsoo Kim
pgtable related functions are mostly in pgtable-generic.c. So move remaining functions from memory.c to pgtable-generic.c. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/memory.c b/mm/memory.c index 1ce2e2a..26bce51 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -374,30 +374,6

[PATCH 1/4] mm, page_alloc: add likely macro to help compiler optimization

2013-08-01 Thread Joonsoo Kim
We rarely allocate a page with ALLOC_NO_WATERMARKS and it is used in slow path. For making fast path more faster, add likely macro to help compiler optimization. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b100255..86ad44b 100644

[PATCH 2/4] mm, migrate: allocation new page lazyily in unmap_and_move()

2013-08-01 Thread Joonsoo Kim
We don't need a new page and then go out immediately if some condition is met. Allocation has overhead in comparison with some condition check, so allocating lazyily is preferable solution. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/migrate.c b/mm/migrate.c index 6f0c244

Re: [PATCH v2 2/3] sched: factor out code to should_we_balance()

2013-08-02 Thread Joonsoo Kim
On Fri, Aug 02, 2013 at 09:51:45AM +0200, Vincent Guittot wrote: On 2 August 2013 03:50, Joonsoo Kim iamjoonsoo@lge.com wrote: Now checking whether this cpu is appropriate to balance or not is embedded into update_sg_lb_stats() and this checking has no direct relationship

[PATCH v2 01/15] slab: correct pfmemalloc check

2013-10-16 Thread Joonsoo Kim
'struct page' of that object, not one of first page, since the SLAB don't use __GFP_COMP when CONFIG_MMU. To get 'struct page' of first page, we first get a slab and try to get it via virt_to_head_page(slab-s_mem). Cc: Mel Gorman mgor...@suse.de Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

[PATCH v2 15/15] slab: rename slab_bufctl to slab_freelist

2013-10-16 Thread Joonsoo Kim
Now, bufctl is not proper name to this array. So change it. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index fbb594f..af2db76 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2550,7 +2550,7 @@ static struct freelist *alloc_slabmgmt(struct kmem_cache *cachep

[PATCH v2 13/15] slab: use struct page for slab management

2013-10-16 Thread Joonsoo Kim
mechanical ones and there is no functional change. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 8b85d8c..4e17190 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -42,18 +42,22 @@ struct page

[PATCH v2 05/15] slab: remove cachep in struct slab_rcu

2013-10-16 Thread Joonsoo Kim
We can get cachep using page in struct slab_rcu, so remove it. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 71ba8f5..7e1aabe 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -204,7 +204,6 @@ typedef unsigned int

[PATCH v2 07/15] slab: use well-defined macro, virt_to_slab()

2013-10-16 Thread Joonsoo Kim
This is trivial change, just use well-defined macro. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 84c4ed6..f9e676e 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2865,7 +2865,6 @@ static inline void

[PATCH v2 14/15] slab: remove useless statement for checking pfmemalloc

2013-10-16 Thread Joonsoo Kim
Now, virt_to_page(page-s_mem) is same as the page, because slab use this structure for management. So remove useless statement. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 0e7f2e7..fbb594f 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -750,9 +750,7

[PATCH v2 12/15] slab: replace free and inuse in struct slab with newly introduced active

2013-10-16 Thread Joonsoo Kim
Now, free in struct slab is same meaning as inuse. So, remove both and replace them with active. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index c271d5b..2ec2336 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -174,8 +174,7 @@ struct slab { struct

[PATCH v2 11/15] slab: remove SLAB_LIMIT

2013-10-16 Thread Joonsoo Kim
It's useless now, so remove it. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 6ced1cc..c271d5b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -163,8 +163,6 @@ */ static bool pfmemalloc_active __read_mostly; -#defineSLAB_LIMIT (((unsigned

[PATCH v2 06/15] slab: overloading the RCU head over the LRU for RCU free

2013-10-16 Thread Joonsoo Kim
-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index d9851ee..8b85d8c 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -130,6 +130,9 @@ struct page { struct

[PATCH v2 08/15] slab: use __GFP_COMP flag for allocating slab pages

2013-10-16 Thread Joonsoo Kim
If we use 'struct page' of first page as 'struct slab', there is no advantage not to use __GFP_COMP. So use __GFP_COMP flag for all the cases. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index f9e676e..75c6082 100644 --- a/mm/slab.c +++ b/mm/slab.c

[PATCH v2 09/15] slab: change the management method of free objects of the slab

2013-10-16 Thread Joonsoo Kim
array: 6 3 7 2 5 4 0 1 To get free objects, we access this array with following pattern. 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 This may help cache line footprint if slab has many objects, and, in addition, this makes code much much simpler. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git

[PATCH v2 10/15] slab: remove kmem_bufctl_t

2013-10-16 Thread Joonsoo Kim
Now, we changed the management method of free objects of the slab and there is no need to use special value, BUFCTL_END, BUFCTL_FREE and BUFCTL_ACTIVE. So remove them. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 05fe37e..6ced1cc 100644 --- a/mm

[PATCH v2 04/15] slab: remove nodeid in struct slab

2013-10-16 Thread Joonsoo Kim
We can get nodeid using address translation, so this field is not useful. Therefore, remove it. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 34eb115..71ba8f5 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -222,7 +222,6 @@ struct slab

[PATCH v2 00/15] slab: overload struct slab over struct page to reduce memory usage

2013-10-16 Thread Joonsoo Kim
, roughly 5%. And elapsed times are also improved by 3.1% to baseline. I think that this patchsets deserve to be merged, since it reduces memory usage and also improves performance. :) Please let me know expert's opinion. Thanks. This patchset is based on v3.12-rc5. Joonsoo Kim (15): slab

[PATCH v2 02/15] slab: change return type of kmem_getpages() to struct page

2013-10-16 Thread Joonsoo Kim
b1f9 mm/slab.o * After textdata bss dec hex filename 22074 23434 4 45512b1c8 mm/slab.o And this help following patch to remove struct slab's colouroff. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm

[PATCH v2 03/15] slab: remove colouroff in struct slab

2013-10-16 Thread Joonsoo Kim
Now there is no user colouroff, so remove it. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 7d79bd7..34eb115 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -219,7 +219,6 @@ struct slab { union

Re: [PATCH v2 01/15] slab: correct pfmemalloc check

2013-10-16 Thread Joonsoo Kim
On Wed, Oct 16, 2013 at 03:27:54PM +, Christoph Lameter wrote: On Wed, 16 Oct 2013, Joonsoo Kim wrote: --- a/mm/slab.c +++ b/mm/slab.c @@ -930,7 +930,8 @@ static void *__ac_put_obj(struct kmem_cache *cachep, struct array_cache *ac, { if (unlikely(pfmemalloc_active

Re: [PATCH v2 00/15] slab: overload struct slab over struct page to reduce memory usage

2013-10-17 Thread Joonsoo Kim
On Wed, Oct 16, 2013 at 01:34:57PM -0700, Andrew Morton wrote: On Wed, 16 Oct 2013 17:43:57 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: There is two main topics in this patchset. One is to reduce memory usage and the other is to change a management method of free objects of a slab

[PATCH v2 1/5] slab: factor out calculate nr objects in cache_estimate

2013-10-17 Thread Joonsoo Kim
This logic is not simple to understand so that making separate function helping readability. Additionally, we can use this change in the following patch which implement for freelist to have another sized index in according to nr objects. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff

[PATCH v2 5/5] slab: make more slab management structure off the slab

2013-10-17 Thread Joonsoo Kim
bytes so that 97 bytes, that is, more than 75% of object size, are wasted. In a 64 byte sized slab case, no space is wasted if we use on-slab. So set off-slab determining constraint to 128 bytes. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff

[PATCH v2 4/5] slab: introduce byte sized index for the freelist of a slab

2013-10-17 Thread Joonsoo Kim
( +- 0.21% ) cache-misses are reduced by this patchset, roughly 5%. And elapsed times are improved by 1%. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 3cee122..2f379ba 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -627,8 +627,8

[PATCH v2 0/5] slab: implement byte sized indexes for the freelist of a slab

2013-10-17 Thread Joonsoo Kim
Patches are on top of my previous posting named as slab: overload struct slab over struct page to reduce memory usage https://lkml.org/lkml/2013/10/16/155 Thanks. Joonsoo Kim (5): slab: factor out calculate nr objects in cache_estimate slab: introduce helper functions to get/set free object

[PATCH v2 3/5] slab: restrict the number of objects in a slab

2013-10-17 Thread Joonsoo Kim
that the number of objects in a slab is less or equal to 256 for a slab with 1 page. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index ec197b9..3cee122 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -157,6 +157,10 @@ #define ARCH_KMALLOC_FLAGS

[PATCH v2 2/5] slab: introduce helper functions to get/set free object

2013-10-17 Thread Joonsoo Kim
In the following patches, to get/set free objects from the freelist is changed so that simple casting doesn't work for it. Therefore, introduce helper functions. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index

Re: [PATCH v2 13/15] slab: use struct page for slab management

2013-10-18 Thread JoonSoo Kim
2013/10/18 Christoph Lameter c...@linux.com: On Wed, 16 Oct 2013, Joonsoo Kim wrote: - * see PAGE_MAPPING_ANON below. - */ + union { + struct address_space *mapping; /* If low bit clear, points

Re: [PATCH v2 3/5] slab: restrict the number of objects in a slab

2013-10-18 Thread JoonSoo Kim
2013/10/18 Christoph Lameter c...@linux.com: n Thu, 17 Oct 2013, Joonsoo Kim wrote: To prepare to implement byte sized index for managing the freelist of a slab, we should restrict the number of objects in a slab to be less or equal to 256, since byte only represent 256 different values

Re: [PATCH v2 08/15] slab: use __GFP_COMP flag for allocating slab pages

2013-10-18 Thread JoonSoo Kim
2013/10/18 Christoph Lameter c...@linux.com: On Wed, 16 Oct 2013, Joonsoo Kim wrote: If we use 'struct page' of first page as 'struct slab', there is no advantage not to use __GFP_COMP. So use __GFP_COMP flag for all the cases. Yes this is going to make the allocators behave in the same way

[PATCH 9/9] mm/rmap: use rmap_walk() in page_mkclean()

2013-11-27 Thread Joonsoo Kim
rmap_walk() in page_mkclean(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index 5e78d5c..bbbc705 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -809,12 +809,13 @@ int page_referenced(struct page *page, } static int page_mkclean_one(struct page *page, struct

[PATCH 4/9] mm/rmap: make rmap_walk to get the rmap_walk_control argument

2013-11-27 Thread Joonsoo Kim
are separate, because it clarify changes. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 45c9b6a..0eef8cb 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -76,8 +76,7 @@ struct page *ksm_might_need_to_copy(struct page *page

[PATCH 6/9] mm/rmap: use rmap_walk() in try_to_unmap()

2013-11-27 Thread Joonsoo Kim
(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 58624b4..d641f6d 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -190,7 +190,7 @@ int page_referenced_one(struct page *, struct vm_area_struct *, int try_to_unmap(struct

[PATCH 7/9] mm/rmap: use rmap_walk() in try_to_munlock()

2013-11-27 Thread Joonsoo Kim
, try_to_unmap_file 2. mechanical change to use rmap_walk() in try_to_munlock(). 3. copy and paste comments. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 0eef8cb..91b9719 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h

[PATCH 1/9] mm/rmap: recompute pgoff for huge page

2013-11-27 Thread Joonsoo Kim
for unmapping huge page). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index 55c8b8d..1214703 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1714,6 +1714,10 @@ static int rmap_walk_file(struct page *page, int (*rmap_one)(struct page *, if (!mapping

[PATCH 0/9] mm/rmap: unify rmap traversing functions through rmap_walk

2013-11-27 Thread Joonsoo Kim
100642750 mm/rmap.o 13823 7058288 228165920 mm/ksm.o 13199 7058288 2219256b0 mm/ksm.o Thanks. Joonsoo Kim (9): mm/rmap: recompute pgoff for huge page mm/rmap: factor nonlinear handling out of try_to_unmap_file() mm/rmap: factor lock function out

[PATCH 5/9] mm/rmap: extend rmap_walk_xxx() to cope with different cases

2013-11-27 Thread Joonsoo Kim
, in this patch, I introduce 4 function pointers to handle above differences. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 0f65686..58624b4 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -239,6 +239,12 @@ struct

[PATCH 8/9] mm/rmap: use rmap_walk() in page_referenced()

2013-11-27 Thread Joonsoo Kim
-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 91b9719..3be6bb1 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -73,8 +73,6 @@ static inline void set_page_stable_node(struct page *page, struct page *ksm_might_need_to_copy(struct page

[PATCH 2/9] mm/rmap: factor nonlinear handling out of try_to_unmap_file()

2013-11-27 Thread Joonsoo Kim
of it. Therfore it is better to factor nonlinear handling out of try_to_unmap_file() in order to merge all kinds of rmap traverse functions easily. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index 1214703..e6d532c 100644 --- a/mm/rmap.c +++ b/mm/rmap.c

[PATCH 3/9] mm/rmap: factor lock function out of rmap_walk_anon()

2013-11-27 Thread Joonsoo Kim
lock function for anon_lock out of rmap_walk_anon(). It will be used in case of removing migration entry and in default of rmap_walk_anon(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index e6d532c..916f2ed 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1683,6

[PATCH v3 5/5] slab: make more slab management structure off the slab

2013-12-02 Thread Joonsoo Kim
bytes so that 97 bytes, that is, more than 75% of object size, are wasted. In a 64 byte sized slab case, no space is wasted if we use on-slab. So set off-slab determining constraint to 128 bytes. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff

[PATCH v3 1/5] slab: factor out calculate nr objects in cache_estimate

2013-12-02 Thread Joonsoo Kim
-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index eb043bf..e749f75 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -565,9 +565,31 @@ static inline struct array_cache *cpu_cache_get(struct kmem_cache *cachep) return cachep-array[smp_processor_id()]; } -static size_t

[PATCH v3 4/5] slab: introduce byte sized index for the freelist of a slab

2013-12-02 Thread Joonsoo Kim
by this patchset, roughly 5%. And elapsed times are improved by 1%. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index 7c3c132..7fab788 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -634,8 +634,8 @@ static void cache_estimate(unsigned long gfporder, size_t buffer_size

[PATCH v3 0/5] slab: implement byte sized indexes for the freelist of a slab

2013-12-02 Thread Joonsoo Kim
Patches are on top of v3.13-rc1. Thanks. Joonsoo Kim (5): slab: factor out calculate nr objects in cache_estimate slab: introduce helper functions to get/set free object slab: restrict the number of objects in a slab slab: introduce byte sized index for the freelist of a slab slab: make

[PATCH v3 3/5] slab: restrict the number of objects in a slab

2013-12-02 Thread Joonsoo Kim
and give up this optimization. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/slab.h b/include/linux/slab.h index c2bba24..23e1fa1 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -201,6 +201,17 @@ struct kmem_cache { #ifndef KMALLOC_SHIFT_LOW #define

[PATCH v3 2/5] slab: introduce helper functions to get/set free object

2013-12-02 Thread Joonsoo Kim
In the following patches, to get/set free objects from the freelist is changed so that simple casting doesn't work for it. Therefore, introduce helper functions. Acked-by: Christoph Lameter c...@linux.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/slab.c b/mm/slab.c index

Re: [PATCH 1/9] mm/rmap: recompute pgoff for huge page

2013-12-02 Thread Joonsoo Kim
On Mon, Dec 02, 2013 at 02:44:34PM -0800, Andrew Morton wrote: On Thu, 28 Nov 2013 16:48:38 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: We have to recompute pgoff if the given page is huge, since result based on HPAGE_SIZE is not approapriate for scanning the vma interval tree

Re: [PATCH 4/9] mm/rmap: make rmap_walk to get the rmap_walk_control argument

2013-12-02 Thread Joonsoo Kim
On Mon, Dec 02, 2013 at 02:51:05PM -0800, Andrew Morton wrote: On Mon, 02 Dec 2013 15:09:33 -0500 Naoya Horiguchi n-horigu...@ah.jp.nec.com wrote: --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -235,11 +235,16 @@ struct anon_vma *page_lock_anon_vma_read(struct page

Re: [PATCH 5/9] mm/rmap: extend rmap_walk_xxx() to cope with different cases

2013-12-02 Thread Joonsoo Kim
On Mon, Dec 02, 2013 at 03:09:42PM -0500, Naoya Horiguchi wrote: diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 0f65686..58624b4 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -239,6 +239,12 @@ struct rmap_walk_control { int (*main)(struct page *,

Re: [PATCH 6/9] mm/rmap: use rmap_walk() in try_to_unmap()

2013-12-02 Thread Joonsoo Kim
On Mon, Dec 02, 2013 at 03:01:07PM -0800, Andrew Morton wrote: On Thu, 28 Nov 2013 16:48:43 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: Now, we have an infrastructure in rmap_walk() to handle difference from variants of rmap traversing functions. So, just use it in try_to_unmap

Re: [PATCH v3 5/5] slab: make more slab management structure off the slab

2013-12-02 Thread Joonsoo Kim
On Mon, Dec 02, 2013 at 02:58:41PM +, Christoph Lameter wrote: On Mon, 2 Dec 2013, Joonsoo Kim wrote: Now, the size of the freelist for the slab management diminish, so that the on-slab management structure can waste large space if the object of the slab is large. Hmmm

Re: [PATCH v3 4/5] slab: introduce byte sized index for the freelist of a slab

2013-12-02 Thread Joonsoo Kim
On Mon, Dec 02, 2013 at 05:49:42PM +0900, Joonsoo Kim wrote: Currently, the freelist of a slab consist of unsigned int sized indexes. Since most of slabs have less number of objects than 256, large sized indexes is needless. For example, consider the minimum kmalloc slab. It's object size

Re: Slab BUG with DEBUG_* options

2013-12-03 Thread Joonsoo Kim
2013/12/3 Pekka Enberg penb...@iki.fi: On 11/30/2013 01:42 PM, Meelis Roos wrote: I am debugging a reboot problem on Sun Ultra 5 (sparc64) with 512M RAM and turned on DEBUG_PAGEALLOC DEBUG_SLAB and DEBUG_SLAB_LEAK (and most other debug options) and got the following BUG and hang on startup.

[PATCH v2 6/9] mm/rmap: use rmap_walk() in try_to_unmap()

2013-12-03 Thread Joonsoo Kim
(). Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 616aa4d..2462458 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -190,7 +190,7 @@ int page_referenced_one(struct page

[PATCH v2 0/9] mm/rmap: unify rmap traversing functions through rmap_walk

2013-12-03 Thread Joonsoo Kim
data bss dec hex filename 10640 1 16 1065729a1 mm/rmap.o 10047 1 16 100642750 mm/rmap.o 13823 7058288 228165920 mm/ksm.o 13199 7058288 2219256b0 mm/ksm.o Thanks. Joonsoo Kim (9): mm/rmap: recompute pgoff

[PATCH v2 9/9] mm/rmap: use rmap_walk() in page_mkclean()

2013-12-03 Thread Joonsoo Kim
rmap_walk() in page_mkclean(). Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index 7944d4b..d792e71 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -808,12 +808,13 @@ int page_referenced(struct page *page

[PATCH v2 7/9] mm/rmap: use rmap_walk() in try_to_munlock()

2013-12-03 Thread Joonsoo Kim
, try_to_unmap_file 2. mechanical change to use rmap_walk() in try_to_munlock(). 3. copy and paste comments. Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 0eef8cb..91b9719 100644

[PATCH v2 8/9] mm/rmap: use rmap_walk() in page_referenced()

2013-12-03 Thread Joonsoo Kim
-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 91b9719..3be6bb1 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -73,8 +73,6 @@ static inline void set_page_stable_node(struct page

[PATCH v2 4/9] mm/rmap: make rmap_walk to get the rmap_walk_control argument

2013-12-03 Thread Joonsoo Kim
are separate, because it clarify changes. Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/ksm.h b/include/linux/ksm.h index 45c9b6a..0eef8cb 100644 --- a/include/linux/ksm.h +++ b/include/linux/ksm.h @@ -76,8 +76,7

[PATCH v2 5/9] mm/rmap: extend rmap_walk_xxx() to cope with different cases

2013-12-03 Thread Joonsoo Kim
, in this patch, I introduce 4 function pointers to handle above differences. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 6a456ce..616aa4d 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -235,10 +235,25 @@ struct

[PATCH v2 1/9] mm/rmap: recompute pgoff for huge page

2013-12-03 Thread Joonsoo Kim
for unmapping huge page). To handle both the cases, normal page for page cache and hugetlb page, by same way, we can use compound_page(). It returns 0 on non-compound page and it also returns proper value on compound page. Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm

[PATCH v2 3/9] mm/rmap: factor lock function out of rmap_walk_anon()

2013-12-03 Thread Joonsoo Kim
lock function for anon_lock out of rmap_walk_anon(). It will be used in case of removing migration entry and in default of rmap_walk_anon(). Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index a387c44

[PATCH v2 2/9] mm/rmap: factor nonlinear handling out of try_to_unmap_file()

2013-12-03 Thread Joonsoo Kim
of it. Therfore it is better to factor nonlinear handling out of try_to_unmap_file() in order to merge all kinds of rmap traverse functions easily. Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/rmap.c b/mm/rmap.c index 20c1a0d

Re: [patch 2/2] fs: buffer: move allocation failure loop into the allocator

2013-12-03 Thread Joonsoo Kim
really really want them to be backed by order=0 pages. Hello, Andrew. Following patch would fix this problem. Thanks. ---8 From 7f21232d1eeffccdbd0f6d79c04d297cf95a713e Mon Sep 17 00:00:00 2001 From: Joonsoo Kim iamjoonsoo@lge.com Date: Wed, 4 Dec 2013 10

Re: [patch 2/2] fs: buffer: move allocation failure loop into the allocator

2013-12-03 Thread Joonsoo Kim
On Tue, Dec 03, 2013 at 06:07:17PM -0800, Andrew Morton wrote: On Wed, 4 Dec 2013 10:52:18 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote: SLUB already try to allocate high order page with clearing __GFP_NOFAIL. But, when allocating shadow page for kmemcheck, it missed clearing the flag

Re: [patch 2/2] fs: buffer: move allocation failure loop into the allocator

2013-12-04 Thread Joonsoo Kim
2013/12/5 Christoph Lameter c...@linux.com: On Tue, 3 Dec 2013, Andrew Morton wrote: page = alloc_slab_page(alloc_gfp, node, oo); if (unlikely(!page)) { oo = s-min; What is the value of s-min? Please tell me it's zero. It usually is. @@ -1349,7 +1350,7 @@ static

Re: [patch 2/2] fs: buffer: move allocation failure loop into the allocator

2013-12-05 Thread Joonsoo Kim
On Wed, Dec 04, 2013 at 04:33:43PM +, Christoph Lameter wrote: On Thu, 5 Dec 2013, Joonsoo Kim wrote: Now we have cpu partial slabs facility, so I think that slowpath isn't really slow. And it doesn't much increase the management overhead in the node partial lists, because of cpu

[PATCH 2/4] mm/mempolicy: correct putback method for isolate pages if failed

2013-12-06 Thread Joonsoo Kim
queue_pages_range() isolates hugetlbfs pages and putback_lru_pages() can't handle these. We should change it to putback_movable_pages(). Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com diff --git a/mm/mempolicy.c b/mm/mempolicy.c index eca4a31..6d04d37 100644 --- a/mm/mempolicy.c +++ b/mm

[PATCH 1/4] mm/migrate: correct return value of migrate_pages()

2013-12-06 Thread Joonsoo Kim
migrate_pages() should return number of pages not migrated or error code. When unmap_and_move return -EAGAIN, outer loop is re-execution without initialising nr_failed. This makes nr_failed over-counted. So this patch correct it by initialising nr_failed in outer loop. Signed-off-by: Joonsoo Kim

<    1   2   3   4   5   6   7   8   9   10   >