Re: [PATCH v4 1/4] mm: fix tracing in free_pcppages_bulk()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 14 Sep 2012 16:29:31 +0200
Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx> wrote:

> page->private gets re-used in __free_one_page() to store page order
> (so trace_mm_page_pcpu_drain() may print order instead of migratetype)
> thus migratetype value must be cached locally.
> 
> Fixes regression introduced in a701623 ("mm: fix migratetype bug
> which slowed swapping").

Grumble.  Please describe a bug when fixing it!  I've added here the
text "This caused incorrect data to be attached to the
mm_page_pcpu_drain trace event", which is hopefully correct enough.

As it's been this way for 2.5 years, I assume that this can wait for
3.7.

> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -668,12 +668,15 @@ static void free_pcppages_bulk(struct zone *zone, int count,
>  			batch_free = to_free;
>  
>  		do {
> +			int mt;
> +
>  			page = list_entry(list->prev, struct page, lru);
>  			/* must delete as __free_one_page list manipulates */
>  			list_del(&page->lru);
> +			mt = page_private(page);
>  			/* 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));
> +			__free_one_page(page, zone, 0, mt);
> +			trace_mm_page_pcpu_drain(page, 0, mt);
>  		} while (--to_free && --batch_free && !list_empty(list));
>  	}
>  	__mod_zone_page_state(zone, NR_FREE_PAGES, count);

More grumble.  Look:

akpm:/usr/src/25> grep migratetype mm/page_alloc.c | wc -l
115

We should respect the established naming conventions.  But reusing
local var `maigratetype' here is not good practice, so how about

--- a/mm/page_alloc.c~mm-fix-tracing-in-free_pcppages_bulk-fix
+++ a/mm/page_alloc.c
@@ -668,7 +668,7 @@ static void free_pcppages_bulk(struct zo
 			batch_free = to_free;
 
 		do {
-			int mt;
+			int mt;	/* migratetype of the to-be-freed page */
 
 			page = list_entry(list->prev, struct page, lru);
 			/* must delete as __free_one_page list manipulates */
_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]