mm/page_owner: Clean up init_pages_in_zone()
Subsystems (2)
PATCH v2 1/1 mm/page_owner: Clean up init_pages_in_zone()
This patch removes two redundant assignments in init_pages_in_zone function.
--- mm/page_owner.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
mm/page_owner.c +2 -5
@@ -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 ;
Signature · 7 lines
2.13.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Oscar Salvador
This patch removes two redundant assignments in
init_pages_in_zonefunction.Signed-off-by Oscar Salvador <[email protected]>
Quoted 38 lines
--- mm/page_owner.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)mm/page_owner.c +2
-5@@ -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 ;Signature · 1 line
2.13.5
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Oscar Salvador
This patch removes two redundant assignments in
init_pages_in_zonefunction.Signed-off-by Oscar Salvador <[email protected]>
A nitpick below.
Quoted 9 lines
--- mm/page_owner.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)mm/page_owner.c +0
-0
mm/page_owner.c read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · line 531
Quoted 6 lines
mm/page_owner.c +0
-2@@ -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
mm/page_owner.c read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · line 532
Quoted 1 line
mm/page_owner.c +0
-0unsigned long end_pfn = pfn + zone->spanned_pages;
While here, I would use zone_end_pfn() on the line above.
mm/page_owner.c read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · line 535
Quoted 3 lines
mm/page_owner.c +0
-0unsigned 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.
Quoted 7 lines
mm/page_owner.c +0
-1- 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);
mm/page_owner.c static void init_pages_in_zone(pg_data_t *pgdat, struct zone *zone) · line 556
Quoted 10 lines
mm/page_owner.c +2
-2block_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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 29 lines · Vlastimil Babka
Quoted 3 lines · Oscar Salvador
This patch removes two redundant assignments in
init_pages_in_zonefunction.Signed-off-by Oscar Salvador <[email protected]>Acked-by Vlastimil Babka <[email protected]>A nitpick below.
Quoted 9 lines
--- mm/page_owner.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)mm/page_owner.c +0
-0mm/page_owner.c read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · line 531
Quoted 6 lines
mm/page_owner.c +0
-2@@ -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_pfndeclaration could be moved to the outer for loopmm/page_owner.c read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · line 532
Quoted 1 line
mm/page_owner.c +0
-0unsigned long end_pfn = pfn + zone->spanned_pages;
Quoted 7 lines
While here, I would use
zone_end_pfn()on the line above.mm/page_owner.c read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · line 535
Quoted 3 lines
mm/page_owner.c +0
-0unsigned 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
Quoted 6 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>