All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 11:46 ` Namhyung Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2011-02-10 11:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Mel Gorman, linux-mm, linux-kernel

Now I'm seeing that there are some cases to free all pages in a
pcp lists. In that case, just frees all pages in the lists instead
of being bothered with round-robin lists traversal.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 mm/page_alloc.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e8b02771ccea..959c54450ddf 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -596,6 +596,28 @@ static void free_pcppages_bulk(struct zone *zone, int count,
 	zone->all_unreclaimable = 0;
 	zone->pages_scanned = 0;
 
+	/* Simple case: Free all */
+	if (to_free == pcp->count) {
+		LIST_HEAD(freelist);
+
+		for (; migratetype < MIGRATE_PCPTYPES; migratetype++)
+			if (!list_empty(&pcp->lists[migratetype]))
+				list_move(&pcp->lists[migratetype], &freelist);
+
+		while (!list_empty(&freelist)) {
+			struct page *page;
+
+			page = list_first_entry(&freelist, struct page, lru);
+			/* must delete as __free_one_page list manipulates */
+			list_del(&page->lru);
+			/* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
+			__free_one_page(page, zone, 0, page_private(page));
+			trace_mm_page_pcpu_drain(page, 0, page_private(page));
+			to_free--;
+		}
+		VM_BUG_ON(to_free);
+	}
+
 	while (to_free) {
 		struct page *page;
 		struct list_head *list;
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 11:46 ` Namhyung Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2011-02-10 11:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Mel Gorman, linux-mm, linux-kernel

Now I'm seeing that there are some cases to free all pages in a
pcp lists. In that case, just frees all pages in the lists instead
of being bothered with round-robin lists traversal.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
 mm/page_alloc.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e8b02771ccea..959c54450ddf 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -596,6 +596,28 @@ static void free_pcppages_bulk(struct zone *zone, int count,
 	zone->all_unreclaimable = 0;
 	zone->pages_scanned = 0;
 
+	/* Simple case: Free all */
+	if (to_free == pcp->count) {
+		LIST_HEAD(freelist);
+
+		for (; migratetype < MIGRATE_PCPTYPES; migratetype++)
+			if (!list_empty(&pcp->lists[migratetype]))
+				list_move(&pcp->lists[migratetype], &freelist);
+
+		while (!list_empty(&freelist)) {
+			struct page *page;
+
+			page = list_first_entry(&freelist, struct page, lru);
+			/* must delete as __free_one_page list manipulates */
+			list_del(&page->lru);
+			/* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
+			__free_one_page(page, zone, 0, page_private(page));
+			trace_mm_page_pcpu_drain(page, 0, page_private(page));
+			to_free--;
+		}
+		VM_BUG_ON(to_free);
+	}
+
 	while (to_free) {
 		struct page *page;
 		struct list_head *list;
-- 
1.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
  2011-02-10 11:46 ` Namhyung Kim
@ 2011-02-10 13:10   ` Minchan Kim
  -1 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2011-02-10 13:10 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

Hello Namhyung,

On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> Now I'm seeing that there are some cases to free all pages in a
> pcp lists. In that case, just frees all pages in the lists instead
> of being bothered with round-robin lists traversal.

I though about that but I didn't send the patch.
That's because many cases which calls free_pcppages_bulk(,
pcp->count,..) are slow path so it adds comparison overhead on fast
path while it loses the effectiveness in slow path.

-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 13:10   ` Minchan Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2011-02-10 13:10 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

Hello Namhyung,

On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> Now I'm seeing that there are some cases to free all pages in a
> pcp lists. In that case, just frees all pages in the lists instead
> of being bothered with round-robin lists traversal.

I though about that but I didn't send the patch.
That's because many cases which calls free_pcppages_bulk(,
pcp->count,..) are slow path so it adds comparison overhead on fast
path while it loses the effectiveness in slow path.

-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
  2011-02-10 13:10   ` Minchan Kim
@ 2011-02-10 13:18     ` Namhyung Kim
  -1 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2011-02-10 13:18 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

2011-02-10 (목), 22:10 +0900, Minchan Kim:
> Hello Namhyung,
> 

Hi Minchan,


> On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> > Now I'm seeing that there are some cases to free all pages in a
> > pcp lists. In that case, just frees all pages in the lists instead
> > of being bothered with round-robin lists traversal.
> 
> I though about that but I didn't send the patch.
> That's because many cases which calls free_pcppages_bulk(,
> pcp->count,..) are slow path so it adds comparison overhead on fast
> path while it loses the effectiveness in slow path.
> 

Hmm.. How about adding unlikely() then? Doesn't it help much here?


-- 
Regards,
Namhyung Kim



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 13:18     ` Namhyung Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2011-02-10 13:18 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

2011-02-10 (ea(C)), 22:10 +0900, Minchan Kim:
> Hello Namhyung,
> 

Hi Minchan,


> On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> > Now I'm seeing that there are some cases to free all pages in a
> > pcp lists. In that case, just frees all pages in the lists instead
> > of being bothered with round-robin lists traversal.
> 
> I though about that but I didn't send the patch.
> That's because many cases which calls free_pcppages_bulk(,
> pcp->count,..) are slow path so it adds comparison overhead on fast
> path while it loses the effectiveness in slow path.
> 

Hmm.. How about adding unlikely() then? Doesn't it help much here?


-- 
Regards,
Namhyung Kim


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
  2011-02-10 13:18     ` Namhyung Kim
@ 2011-02-10 13:38       ` Minchan Kim
  -1 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2011-02-10 13:38 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

On Thu, Feb 10, 2011 at 10:18 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> 2011-02-10 (목), 22:10 +0900, Minchan Kim:
>> Hello Namhyung,
>>
>
> Hi Minchan,
>
>
>> On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
>> > Now I'm seeing that there are some cases to free all pages in a
>> > pcp lists. In that case, just frees all pages in the lists instead
>> > of being bothered with round-robin lists traversal.
>>
>> I though about that but I didn't send the patch.
>> That's because many cases which calls free_pcppages_bulk(,
>> pcp->count,..) are slow path so it adds comparison overhead on fast
>> path while it loses the effectiveness in slow path.
>>
>
> Hmm.. How about adding unlikely() then? Doesn't it help much here?

Yes. It would help but I am not sure how much it is.
AFAIR, when Mel submit the patch, he tried to prove the effectiveness
with some experiment and profiler.
I think if you want it really, we might need some number.
I am not sure it's worth.




-- 
Kind regards,
Minchan Kim

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 13:38       ` Minchan Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Minchan Kim @ 2011-02-10 13:38 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

On Thu, Feb 10, 2011 at 10:18 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> 2011-02-10 (목), 22:10 +0900, Minchan Kim:
>> Hello Namhyung,
>>
>
> Hi Minchan,
>
>
>> On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
>> > Now I'm seeing that there are some cases to free all pages in a
>> > pcp lists. In that case, just frees all pages in the lists instead
>> > of being bothered with round-robin lists traversal.
>>
>> I though about that but I didn't send the patch.
>> That's because many cases which calls free_pcppages_bulk(,
>> pcp->count,..) are slow path so it adds comparison overhead on fast
>> path while it loses the effectiveness in slow path.
>>
>
> Hmm.. How about adding unlikely() then? Doesn't it help much here?

Yes. It would help but I am not sure how much it is.
AFAIR, when Mel submit the patch, he tried to prove the effectiveness
with some experiment and profiler.
I think if you want it really, we might need some number.
I am not sure it's worth.




-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
  2011-02-10 13:38       ` Minchan Kim
@ 2011-02-10 13:53         ` Namhyung Kim
  -1 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2011-02-10 13:53 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

2011-02-10 (목), 22:38 +0900, Minchan Kim:
> > Hmm.. How about adding unlikely() then? Doesn't it help much here?
> 
> Yes. It would help but I am not sure how much it is.
> AFAIR, when Mel submit the patch, he tried to prove the effectiveness
> with some experiment and profiler.
> I think if you want it really, we might need some number.
> I am not sure it's worth.
> 

OK. Thanks for the comments. :)

And it would be really great if you (or somebody) told me how could I
make the numbers on my desktop.


-- 
Regards,
Namhyung Kim



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 13:53         ` Namhyung Kim
  0 siblings, 0 replies; 12+ messages in thread
From: Namhyung Kim @ 2011-02-10 13:53 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, Mel Gorman, linux-mm, linux-kernel

2011-02-10 (ea(C)), 22:38 +0900, Minchan Kim:
> > Hmm.. How about adding unlikely() then? Doesn't it help much here?
> 
> Yes. It would help but I am not sure how much it is.
> AFAIR, when Mel submit the patch, he tried to prove the effectiveness
> with some experiment and profiler.
> I think if you want it really, we might need some number.
> I am not sure it's worth.
> 

OK. Thanks for the comments. :)

And it would be really great if you (or somebody) told me how could I
make the numbers on my desktop.


-- 
Regards,
Namhyung Kim


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
  2011-02-10 13:38       ` Minchan Kim
@ 2011-02-10 14:05         ` Mel Gorman
  -1 siblings, 0 replies; 12+ messages in thread
From: Mel Gorman @ 2011-02-10 14:05 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Namhyung Kim, Andrew Morton, linux-mm, linux-kernel

On Thu, Feb 10, 2011 at 10:38:59PM +0900, Minchan Kim wrote:
> On Thu, Feb 10, 2011 at 10:18 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> > 2011-02-10 (???), 22:10 +0900, Minchan Kim:
> >> Hello Namhyung,
> >>
> >
> > Hi Minchan,
> >
> >
> >> On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> >> > Now I'm seeing that there are some cases to free all pages in a
> >> > pcp lists. In that case, just frees all pages in the lists instead
> >> > of being bothered with round-robin lists traversal.
> >>
> >> I though about that but I didn't send the patch.
> >> That's because many cases which calls free_pcppages_bulk(,
> >> pcp->count,..) are slow path so it adds comparison overhead on fast
> >> path while it loses the effectiveness in slow path.
> >>
> >
> > Hmm.. How about adding unlikely() then? Doesn't it help much here?
> 
> Yes. It would help but I am not sure how much it is.
> AFAIR, when Mel submit the patch, he tried to prove the effectiveness
> with some experiment and profiler.

Yep. Principally I *think* used netperf running UDP_STREAM for different
buffer sizes and compared oprofile output but I also ran a battery of
benchmarks to check for any other unexpected regression without profiling.

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [RFC PATCH] mm: handle simple case in free_pcppages_bulk()
@ 2011-02-10 14:05         ` Mel Gorman
  0 siblings, 0 replies; 12+ messages in thread
From: Mel Gorman @ 2011-02-10 14:05 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Namhyung Kim, Andrew Morton, linux-mm, linux-kernel

On Thu, Feb 10, 2011 at 10:38:59PM +0900, Minchan Kim wrote:
> On Thu, Feb 10, 2011 at 10:18 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> > 2011-02-10 (???), 22:10 +0900, Minchan Kim:
> >> Hello Namhyung,
> >>
> >
> > Hi Minchan,
> >
> >
> >> On Thu, Feb 10, 2011 at 8:46 PM, Namhyung Kim <namhyung@gmail.com> wrote:
> >> > Now I'm seeing that there are some cases to free all pages in a
> >> > pcp lists. In that case, just frees all pages in the lists instead
> >> > of being bothered with round-robin lists traversal.
> >>
> >> I though about that but I didn't send the patch.
> >> That's because many cases which calls free_pcppages_bulk(,
> >> pcp->count,..) are slow path so it adds comparison overhead on fast
> >> path while it loses the effectiveness in slow path.
> >>
> >
> > Hmm.. How about adding unlikely() then? Doesn't it help much here?
> 
> Yes. It would help but I am not sure how much it is.
> AFAIR, when Mel submit the patch, he tried to prove the effectiveness
> with some experiment and profiler.

Yep. Principally I *think* used netperf running UDP_STREAM for different
buffer sizes and compared oprofile output but I also ran a battery of
benchmarks to check for any other unexpected regression without profiling.

-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-02-10 14:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-10 11:46 [RFC PATCH] mm: handle simple case in free_pcppages_bulk() Namhyung Kim
2011-02-10 11:46 ` Namhyung Kim
2011-02-10 13:10 ` Minchan Kim
2011-02-10 13:10   ` Minchan Kim
2011-02-10 13:18   ` Namhyung Kim
2011-02-10 13:18     ` Namhyung Kim
2011-02-10 13:38     ` Minchan Kim
2011-02-10 13:38       ` Minchan Kim
2011-02-10 13:53       ` Namhyung Kim
2011-02-10 13:53         ` Namhyung Kim
2011-02-10 14:05       ` Mel Gorman
2011-02-10 14:05         ` Mel Gorman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.