linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* a bug report for function move_freepages_block
@ 2013-10-06 11:26 martin zhang
  0 siblings, 0 replies; only message in thread
From: martin zhang @ 2013-10-06 11:26 UTC (permalink / raw)
  To: linux-mm

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

HI all,
I think there is a bug in function move_freepages_block.

 981 int move_freepages_block(struct zone *zone, struct page *page,
...
 987         start_pfn = page_to_pfn(page);
 988         start_pfn = start_pfn & ~(pageblock_nr_pages-1);
 989         start_page = pfn_to_page(start_pfn);
 990         end_page = start_page + pageblock_nr_pages - 1;
 991         end_pfn = start_pfn + pageblock_nr_pages - 1;
 992
 993         /* Do not cross zone boundaries */
 994         if (!zone_spans_pfn(zone, start_pfn))
 995                 start_page = page;

The line 988 will align start_pfn with pageblock_nr_pages,
thus after line988, start_pfn maybe less than zone->pageblock_nr_pages,
in the worst case, start_pfn maybe outof the range of zone->node pfn.
and becomes a invalid pfn.
in this case, line 989 will be wrong.

so I think the check for start_pfn should be done before line 989, just
like:
    start_pfn = start_pfn & ~(pageblock_nr_pages-1); <== line 988
    if (!zone_spans_pfn(zone, start_pfn))
    start_pfn = page_to_pfn(page);

Regards,
Martin

[-- Attachment #2: Type: text/html, Size: 1632 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-10-06 11:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-06 11:26 a bug report for function move_freepages_block martin zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).