[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100905180619.GE8384@csn.ul.ie>
Date: Sun, 5 Sep 2010 19:06:20 +0100
From: Mel Gorman <mel@....ul.ie>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linux Kernel List <linux-kernel@...r.kernel.org>,
linux-mm@...ck.org, Rik van Riel <riel@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Minchan Kim <minchan.kim@...il.com>,
Christoph Lameter <cl@...ux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Subject: Re: [PATCH 1/3] mm: page allocator: Update free page counters
after pages are placed on the free list
On Fri, Sep 03, 2010 at 03:38:59PM -0700, Andrew Morton wrote:
> On Fri, 3 Sep 2010 10:08:44 +0100
> Mel Gorman <mel@....ul.ie> wrote:
>
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -588,12 +588,12 @@ static void free_pcppages_bulk(struct zone *zone, int count,
> > {
> > int migratetype = 0;
> > int batch_free = 0;
> > + int freed = count;
> >
> > spin_lock(&zone->lock);
> > zone->all_unreclaimable = 0;
> > zone->pages_scanned = 0;
> >
> > - __mod_zone_page_state(zone, NR_FREE_PAGES, count);
> > while (count) {
> > struct page *page;
> > struct list_head *list;
> > @@ -621,6 +621,7 @@ static void free_pcppages_bulk(struct zone *zone, int count,
> > trace_mm_page_pcpu_drain(page, 0, page_private(page));
> > } while (--count && --batch_free && !list_empty(list));
> > }
> > + __mod_zone_page_state(zone, NR_FREE_PAGES, freed);
> > spin_unlock(&zone->lock);
> > }
> >
>
> nit: this is why it's evil to modify the value of incoming args. It's
> nicer to leave them alone and treat them as const across the lifetime
> of the callee.
>
Ok, I can see the logic of that.
> Can I do this?
>
> --- a/mm/page_alloc.c~mm-page-allocator-update-free-page-counters-after-pages-are-placed-on-the-free-list-fix
> +++ a/mm/page_alloc.c
> @@ -588,13 +588,13 @@ static void free_pcppages_bulk(struct zo
> {
> int migratetype = 0;
> int batch_free = 0;
> - int freed = count;
> + int to_free = count;
>
> spin_lock(&zone->lock);
> zone->all_unreclaimable = 0;
> zone->pages_scanned = 0;
>
> - while (count) {
> + while (to_free) {
> struct page *page;
> struct list_head *list;
>
> @@ -619,9 +619,9 @@ static void free_pcppages_bulk(struct zo
> /* 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));
> - } while (--count && --batch_free && !list_empty(list));
> + } while (--to_free && --batch_free && !list_empty(list));
> }
> - __mod_zone_page_state(zone, NR_FREE_PAGES, freed);
> + __mod_zone_page_state(zone, NR_FREE_PAGES, count);
> spin_unlock(&zone->lock);
> }
Yes you can. I see no problem with this alteration.
--
Mel Gorman
Part-time Phd Student Linux Technology Center
University of Limerick IBM Dublin Software Lab
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists