All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mm/page_owner: Clean up init_pages_in_zone()
@ 2018-01-10  8:43 Oscar Salvador
  2018-01-10 12:10 ` Michal Hocko
  2018-01-17 10:02 ` Vlastimil Babka
  0 siblings, 2 replies; 4+ messages in thread
From: Oscar Salvador @ 2018-01-10  8:43 UTC (permalink / raw)
  To: linux-mm; +Cc: vbabka, mhocko, akpm

This patch removes two redundant assignments in init_pages_in_zone function.

Signed-off-by: Oscar Salvador <osalvador@techadventures.net>
---
 mm/page_owner.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 69f83fc763bb..b361781e5ab6 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -528,14 +528,11 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 
 static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
 {
-	struct page *page;
-	struct page_ext *page_ext;
 	unsigned long pfn = zone->zone_start_pfn, block_end_pfn;
 	unsigned long end_pfn = pfn + zone->spanned_pages;
 	unsigned long count = 0;
 
 	/* Scan block by block. First and last block may be incomplete */
-	pfn = zone->zone_start_pfn;
 
 	/*
 	 * Walk the zone in pageblock_nr_pages steps. If a page block spans
@@ -551,9 +548,9 @@ static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
 		block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
 		block_end_pfn = min(block_end_pfn, end_pfn);
 
-		page = pfn_to_page(pfn);
-
 		for (; pfn < block_end_pfn; pfn++) {
+			struct page *page;
+			struct page_ext *page_ext;
 			if (!pfn_valid_within(pfn))
 				continue;
 
-- 
2.13.5

--
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>

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

* Re: [PATCH v2] mm/page_owner: Clean up init_pages_in_zone()
  2018-01-10  8:43 [PATCH v2] mm/page_owner: Clean up init_pages_in_zone() Oscar Salvador
@ 2018-01-10 12:10 ` Michal Hocko
  2018-01-17 10:02 ` Vlastimil Babka
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2018-01-10 12:10 UTC (permalink / raw)
  To: Oscar Salvador; +Cc: linux-mm, vbabka, akpm

On Wed 10-01-18 09:43:55, Oscar Salvador wrote:
> This patch removes two redundant assignments in init_pages_in_zone function.
> 
> Signed-off-by: Oscar Salvador <osalvador@techadventures.net>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/page_owner.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 69f83fc763bb..b361781e5ab6 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -528,14 +528,11 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>  
>  static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
>  {
> -	struct page *page;
> -	struct page_ext *page_ext;
>  	unsigned long pfn = zone->zone_start_pfn, block_end_pfn;
>  	unsigned long end_pfn = pfn + zone->spanned_pages;
>  	unsigned long count = 0;
>  
>  	/* Scan block by block. First and last block may be incomplete */
> -	pfn = zone->zone_start_pfn;
>  
>  	/*
>  	 * Walk the zone in pageblock_nr_pages steps. If a page block spans
> @@ -551,9 +548,9 @@ static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
>  		block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
>  		block_end_pfn = min(block_end_pfn, end_pfn);
>  
> -		page = pfn_to_page(pfn);
> -
>  		for (; pfn < block_end_pfn; pfn++) {
> +			struct page *page;
> +			struct page_ext *page_ext;
>  			if (!pfn_valid_within(pfn))
>  				continue;
>  
> -- 
> 2.13.5
> 

-- 
Michal Hocko
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH v2] mm/page_owner: Clean up init_pages_in_zone()
  2018-01-10  8:43 [PATCH v2] mm/page_owner: Clean up init_pages_in_zone() Oscar Salvador
  2018-01-10 12:10 ` Michal Hocko
@ 2018-01-17 10:02 ` Vlastimil Babka
  2018-01-17 12:14   ` Oscar Salvador
  1 sibling, 1 reply; 4+ messages in thread
From: Vlastimil Babka @ 2018-01-17 10:02 UTC (permalink / raw)
  To: Oscar Salvador, linux-mm; +Cc: mhocko, akpm

On 01/10/2018 09:43 AM, Oscar Salvador wrote:
> This patch removes two redundant assignments in init_pages_in_zone function.
> 
> Signed-off-by: Oscar Salvador <osalvador@techadventures.net>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

A nitpick below.

> ---
>  mm/page_owner.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/page_owner.c b/mm/page_owner.c
> index 69f83fc763bb..b361781e5ab6 100644
> --- a/mm/page_owner.c
> +++ b/mm/page_owner.c
> @@ -528,14 +528,11 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>  
>  static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
>  {
> -	struct page *page;
> -	struct page_ext *page_ext;
>  	unsigned long pfn = zone->zone_start_pfn, block_end_pfn;

block_end_pfn declaration could be moved to the outer for loop

>  	unsigned long end_pfn = pfn + zone->spanned_pages;

While here, I would use zone_end_pfn() on the line above.

>  	unsigned long count = 0;
>  
>  	/* Scan block by block. First and last block may be incomplete */

Now the comment is stray, I would just remove it too.

> -	pfn = zone->zone_start_pfn;
>  
>  	/*
>  	 * Walk the zone in pageblock_nr_pages steps. If a page block spans
> @@ -551,9 +548,9 @@ static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
>  		block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
>  		block_end_pfn = min(block_end_pfn, end_pfn);
>  
> -		page = pfn_to_page(pfn);
> -
>  		for (; pfn < block_end_pfn; pfn++) {
> +			struct page *page;
> +			struct page_ext *page_ext;
>  			if (!pfn_valid_within(pfn))
>  				continue;
>  
> 

--
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>

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

* Re: [PATCH v2] mm/page_owner: Clean up init_pages_in_zone()
  2018-01-17 10:02 ` Vlastimil Babka
@ 2018-01-17 12:14   ` Oscar Salvador
  0 siblings, 0 replies; 4+ messages in thread
From: Oscar Salvador @ 2018-01-17 12:14 UTC (permalink / raw)
  To: Vlastimil Babka; +Cc: linux-mm, mhocko, akpm

On Wed, Jan 17, 2018 at 11:02:24AM +0100, Vlastimil Babka wrote:
> On 01/10/2018 09:43 AM, Oscar Salvador wrote:
> > This patch removes two redundant assignments in init_pages_in_zone function.
> > 
> > Signed-off-by: Oscar Salvador <osalvador@techadventures.net>
> 
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> 
> A nitpick below.
> 
> > ---
> >  mm/page_owner.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/mm/page_owner.c b/mm/page_owner.c
> > index 69f83fc763bb..b361781e5ab6 100644
> > --- a/mm/page_owner.c
> > +++ b/mm/page_owner.c
> > @@ -528,14 +528,11 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
> >  
> >  static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone)
> >  {
> > -	struct page *page;
> > -	struct page_ext *page_ext;
> >  	unsigned long pfn = zone->zone_start_pfn, block_end_pfn;
> 
> block_end_pfn declaration could be moved to the outer for loop
> 
> >  	unsigned long end_pfn = pfn + zone->spanned_pages;
> 
> While here, I would use zone_end_pfn() on the line above.
> 
> >  	unsigned long count = 0;
> >  
> >  	/* Scan block by block. First and last block may be incomplete */
> 
> Now the comment is stray, I would just remove it too.

Hi Vlastimil, thanks for the fixes.
I'll send v3 with your suggestions.

Thanks

> 
> --
> 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>

--
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>

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

end of thread, other threads:[~2018-01-17 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10  8:43 [PATCH v2] mm/page_owner: Clean up init_pages_in_zone() Oscar Salvador
2018-01-10 12:10 ` Michal Hocko
2018-01-17 10:02 ` Vlastimil Babka
2018-01-17 12:14   ` Oscar Salvador

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.