From: Andrew Morton <akpm@linux-foundation.org>
To: Oscar Salvador <osalvador@suse.de>
Cc: David Hildenbrand <david@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
mhocko@suse.com
Subject: Re: [PATCH] mm,memory_hotplug: Fix scan_movable_pages for gigantic hugepages
Date: Mon, 28 Jan 2019 14:53:09 -0800 [thread overview]
Message-ID: <20190128145309.c7dcf075b469d6a54694327d@linux-foundation.org> (raw)
In-Reply-To: <20190125075830.6mqw2io4rwz7wxx5@d104.suse.de>
On Fri, 25 Jan 2019 08:58:33 +0100 Oscar Salvador <osalvador@suse.de> wrote:
> On Wed, Jan 23, 2019 at 11:33:56AM +0100, David Hildenbrand wrote:
> > If you use {} for the else case, please also do so for the if case.
>
> Diff on top:
>
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 25aee4f04a72..d5810e522b72 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1338,9 +1338,9 @@ static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
> struct page *head = compound_head(page);
>
> if (hugepage_migration_supported(page_hstate(head)) &&
> - page_huge_active(head))
> + page_huge_active(head)) {
> return pfn;
> - else {
> + } else {
> unsigned long skip;
>
> skip = (1 << compound_order(head)) - (page - head);
>
The indenting is getting a bit deep also, so how about this?
static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
{
unsigned long pfn;
for (pfn = start; pfn < end; pfn++) {
struct page *page, *head;
if (!pfn_valid(pfn))
continue;
page = pfn_to_page(pfn);
if (PageLRU(page))
return pfn;
if (__PageMovable(page))
return pfn;
if (!PageHuge(page))
continue;
head = compound_head(page);
if (hugepage_migration_supported(page_hstate(head)) &&
page_huge_active(head)) {
return pfn;
} else {
unsigned long skip;
skip = (1 << compound_order(head)) - (page - head);
pfn += skip - 1;
}
}
return 0;
}
From: Andrew Morton <akpm@linux-foundation.org>
Subject: mmmemory_hotplug-fix-scan_movable_pages-for-gigantic-hugepages-fix
fix brace layout, per David. Also reduce indentation
Cc: Anthony Yznaga <anthony.yznaga@oracle.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/memory_hotplug.c | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
--- a/mm/memory_hotplug.c~mmmemory_hotplug-fix-scan_movable_pages-for-gigantic-hugepages-fix
+++ a/mm/memory_hotplug.c
@@ -1305,27 +1305,29 @@ int test_pages_in_a_zone(unsigned long s
static unsigned long scan_movable_pages(unsigned long start, unsigned long end)
{
unsigned long pfn;
- struct page *page;
+
for (pfn = start; pfn < end; pfn++) {
- if (pfn_valid(pfn)) {
- page = pfn_to_page(pfn);
- if (PageLRU(page))
- return pfn;
- if (__PageMovable(page))
- return pfn;
- if (PageHuge(page)) {
- struct page *head = compound_head(page);
+ struct page *page, *head;
+
+ if (!pfn_valid(pfn))
+ continue;
+ page = pfn_to_page(pfn);
+ if (PageLRU(page))
+ return pfn;
+ if (__PageMovable(page))
+ return pfn;
- if (hugepage_migration_supported(page_hstate(head)) &&
- page_huge_active(head))
- return pfn;
- else {
- unsigned long skip;
+ if (!PageHuge(page))
+ continue;
+ head = compound_head(page);
+ if (hugepage_migration_supported(page_hstate(head)) &&
+ page_huge_active(head)) {
+ return pfn;
+ } else {
+ unsigned long skip;
- skip = (1 << compound_order(head)) - (page - head);
- pfn += skip - 1;
- }
- }
+ skip = (1 << compound_order(head)) - (page - head);
+ pfn += skip - 1;
}
}
return 0;
_
next prev parent reply other threads:[~2019-01-28 22:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 15:44 [PATCH] mm,memory_hotplug: Fix scan_movable_pages for gigantic hugepages Oscar Salvador
2019-01-22 23:47 ` Anthony Yznaga
2019-01-23 9:47 ` Michal Hocko
2019-01-23 10:18 ` Oscar Salvador
2019-01-23 10:22 ` Michal Hocko
2019-01-23 10:33 ` David Hildenbrand
2019-01-25 7:58 ` Oscar Salvador
2019-01-28 22:53 ` Andrew Morton [this message]
2019-01-28 22:56 ` Andrew Morton
2019-01-29 7:33 ` Michal Hocko
2019-01-29 8:27 ` Oscar Salvador
2019-01-29 10:03 ` David Hildenbrand
2019-01-30 7:52 ` Oscar Salvador
2019-01-28 22:53 ` Andrew Morton
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=20190128145309.c7dcf075b469d6a54694327d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).