Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281894 > unrolled thread

[PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()

Started byGeliang Tang <geliangtang@163.com>
First post2015-12-02 16:20 +0100
Last post2015-12-03 02:30 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages() Geliang Tang <geliangtang@163.com> - 2015-12-02 16:20 +0100
    Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in  mark_free_pages() Michal Hocko <mhocko@kernel.org> - 2015-12-02 17:40 +0100
    Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in  mark_free_pages() Mel Gorman <mgorman@techsingularity.net> - 2015-12-02 17:50 +0100
    Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in  mark_free_pages() David Rientjes <rientjes@google.com> - 2015-12-03 02:30 +0100

#1281894 — [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()

FromGeliang Tang <geliangtang@163.com>
Date2015-12-02 16:20 +0100
Subject[PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()
Message-ID<qBhmh-sK-5@gated-at.bofh.it>
Use list_for_each_entry instead of list_for_each + list_entry to
simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1282000 — Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()

FromMichal Hocko <mhocko@kernel.org>
Date2015-12-02 17:40 +0100
SubjectRe: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()
Message-ID<qBiBJ-1dB-37@gated-at.bofh.it>
In reply to#1281894
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@163.com>

Acked-by: Michal Hocko <mhocko@suse.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@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282007 — Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()

FromMel Gorman <mgorman@techsingularity.net>
Date2015-12-02 17:50 +0100
SubjectRe: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()
Message-ID<qBiLo-1hG-25@gated-at.bofh.it>
In reply to#1281894
On Wed, Dec 02, 2015 at 11:12:41PM +0800, 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@163.com>

Acked-by: Mel Gorman <mgorman@techsingularity.net>

-- 
Mel Gorman
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282633 — Re: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()

FromDavid Rientjes <rientjes@google.com>
Date2015-12-03 02:30 +0100
SubjectRe: [PATCH 2/2] mm/page_alloc.c: use list_for_each_entry in mark_free_pages()
Message-ID<qBqSC-6Bi-1@gated-at.bofh.it>
In reply to#1281894
On Wed, 2 Dec 2015, 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@163.com>

Acked-by: David Rientjes <rientjes@google.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web