mm: use zone_end_pfn() instead of zone_start_pfn+spanned_pages
Use "zone_end_pfn()" instead of "zone->zone_start_pfn + zone->spanned_pages". Simplify the code, no functional change. [akpm@linux-foundation.org: fix build] Signed-off-by: Xishi Qiu <qiuxishi@huawei.com> Cc: Cody P Schafer <cody@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
674470d979
commit
c33bc315fd
2 changed files with 10 additions and 9 deletions
|
@ -352,7 +352,7 @@ static int create_mem_extents(struct list_head *list, gfp_t gfp_mask)
|
||||||
struct mem_extent *ext, *cur, *aux;
|
struct mem_extent *ext, *cur, *aux;
|
||||||
|
|
||||||
zone_start = zone->zone_start_pfn;
|
zone_start = zone->zone_start_pfn;
|
||||||
zone_end = zone->zone_start_pfn + zone->spanned_pages;
|
zone_end = zone_end_pfn(zone);
|
||||||
|
|
||||||
list_for_each_entry(ext, list, hook)
|
list_for_each_entry(ext, list, hook)
|
||||||
if (zone_start <= ext->end)
|
if (zone_start <= ext->end)
|
||||||
|
@ -884,7 +884,7 @@ static unsigned int count_highmem_pages(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mark_free_pages(zone);
|
mark_free_pages(zone);
|
||||||
max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
max_zone_pfn = zone_end_pfn(zone);
|
||||||
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
||||||
if (saveable_highmem_page(zone, pfn))
|
if (saveable_highmem_page(zone, pfn))
|
||||||
n++;
|
n++;
|
||||||
|
@ -948,7 +948,7 @@ static unsigned int count_data_pages(void)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mark_free_pages(zone);
|
mark_free_pages(zone);
|
||||||
max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
max_zone_pfn = zone_end_pfn(zone);
|
||||||
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
||||||
if (saveable_page(zone, pfn))
|
if (saveable_page(zone, pfn))
|
||||||
n++;
|
n++;
|
||||||
|
@ -1041,7 +1041,7 @@ copy_data_pages(struct memory_bitmap *copy_bm, struct memory_bitmap *orig_bm)
|
||||||
unsigned long max_zone_pfn;
|
unsigned long max_zone_pfn;
|
||||||
|
|
||||||
mark_free_pages(zone);
|
mark_free_pages(zone);
|
||||||
max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
max_zone_pfn = zone_end_pfn(zone);
|
||||||
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
||||||
if (page_is_saveable(zone, pfn))
|
if (page_is_saveable(zone, pfn))
|
||||||
memory_bm_set_bit(orig_bm, pfn);
|
memory_bm_set_bit(orig_bm, pfn);
|
||||||
|
@ -1093,7 +1093,7 @@ void swsusp_free(void)
|
||||||
unsigned long pfn, max_zone_pfn;
|
unsigned long pfn, max_zone_pfn;
|
||||||
|
|
||||||
for_each_populated_zone(zone) {
|
for_each_populated_zone(zone) {
|
||||||
max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
max_zone_pfn = zone_end_pfn(zone);
|
||||||
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
||||||
if (pfn_valid(pfn)) {
|
if (pfn_valid(pfn)) {
|
||||||
struct page *page = pfn_to_page(pfn);
|
struct page *page = pfn_to_page(pfn);
|
||||||
|
@ -1755,7 +1755,7 @@ static int mark_unsafe_pages(struct memory_bitmap *bm)
|
||||||
|
|
||||||
/* Clear page flags */
|
/* Clear page flags */
|
||||||
for_each_populated_zone(zone) {
|
for_each_populated_zone(zone) {
|
||||||
max_zone_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
max_zone_pfn = zone_end_pfn(zone);
|
||||||
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
for (pfn = zone->zone_start_pfn; pfn < max_zone_pfn; pfn++)
|
||||||
if (pfn_valid(pfn))
|
if (pfn_valid(pfn))
|
||||||
swsusp_unset_page_free(pfn_to_page(pfn));
|
swsusp_unset_page_free(pfn_to_page(pfn));
|
||||||
|
|
|
@ -229,7 +229,7 @@ static void grow_zone_span(struct zone *zone, unsigned long start_pfn,
|
||||||
|
|
||||||
zone_span_writelock(zone);
|
zone_span_writelock(zone);
|
||||||
|
|
||||||
old_zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
old_zone_end_pfn = zone_end_pfn(zone);
|
||||||
if (!zone->spanned_pages || start_pfn < zone->zone_start_pfn)
|
if (!zone->spanned_pages || start_pfn < zone->zone_start_pfn)
|
||||||
zone->zone_start_pfn = start_pfn;
|
zone->zone_start_pfn = start_pfn;
|
||||||
|
|
||||||
|
@ -514,8 +514,9 @@ static int find_biggest_section_pfn(int nid, struct zone *zone,
|
||||||
static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
|
static void shrink_zone_span(struct zone *zone, unsigned long start_pfn,
|
||||||
unsigned long end_pfn)
|
unsigned long end_pfn)
|
||||||
{
|
{
|
||||||
unsigned long zone_start_pfn = zone->zone_start_pfn;
|
unsigned long zone_start_pfn = zone->zone_start_pfn;
|
||||||
unsigned long zone_end_pfn = zone->zone_start_pfn + zone->spanned_pages;
|
unsigned long z = zone_end_pfn(zone); /* zone_end_pfn namespace clash */
|
||||||
|
unsigned long zone_end_pfn = z;
|
||||||
unsigned long pfn;
|
unsigned long pfn;
|
||||||
struct mem_section *ms;
|
struct mem_section *ms;
|
||||||
int nid = zone_to_nid(zone);
|
int nid = zone_to_nid(zone);
|
||||||
|
|
Loading…
Reference in a new issue