linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: martin zhang <martinbj2008@gmail.com>
To: linux-mm@kvack.org
Subject: a bug report for function move_freepages_block
Date: Sun, 6 Oct 2013 19:26:51 +0800	[thread overview]
Message-ID: <CAADRoS2rZEpk1eCzjo=_GPGcR56AgNYOTjz0WCSq3V7-hOJ2Xw@mail.gmail.com> (raw)

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

                 reply	other threads:[~2013-10-06 11:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAADRoS2rZEpk1eCzjo=_GPGcR56AgNYOTjz0WCSq3V7-hOJ2Xw@mail.gmail.com' \
    --to=martinbj2008@gmail.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox