[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151202163227.GL25284@dhcp22.suse.cz>
Date: Wed, 2 Dec 2015 17:32:27 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Geliang Tang <geliangtang@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Mel Gorman <mgorman@...hsingularity.net>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <js1304@...il.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Johannes Weiner <hannes@...xchg.org>,
Alexander Duyck <alexander.h.duyck@...hat.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in
mark_free_pages()
On Wed 02-12-15 23:12:41, Geliang Tang wrote:
> Use list_for_each_entry instead of list_for_each + list_entry to
> simplify the code.
>
> Signed-off-by: Geliang Tang <geliangtang@....com>
Acked-by: Michal Hocko <mhocko@...e.com>
> ---
> mm/page_alloc.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0d38185..1c1ad58 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2027,7 +2027,7 @@ void mark_free_pages(struct zone *zone)
> unsigned long pfn, max_zone_pfn;
> unsigned long flags;
> unsigned int order, t;
> - struct list_head *curr;
> + struct page *page;
>
> if (zone_is_empty(zone))
> return;
> @@ -2037,17 +2037,17 @@ void mark_free_pages(struct zone *zone)
> max_zone_pfn = zone_end_pfn(zone);
> for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
> if (pfn_valid(pfn)) {
> - struct page *page = pfn_to_page(pfn);
> -
> + page = pfn_to_page(pfn);
> if (!swsusp_page_is_forbidden(page))
> swsusp_unset_page_free(page);
> }
>
> for_each_migratetype_order(order, t) {
> - list_for_each(curr, &zone->free_area[order].free_list[t]) {
> + list_for_each_entry(page,
> + &zone->free_area[order].free_list[t], lru) {
> unsigned long i;
>
> - pfn = page_to_pfn(list_entry(curr, struct page, lru));
> + pfn = page_to_pfn(page);
> for (i = 0; i < (1UL << order); i++)
> swsusp_set_page_free(pfn_to_page(pfn + i));
> }
> --
> 2.5.0
>
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
--
Michal Hocko
SUSE Labs
--
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