From: David Hildenbrand <david@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, David Hildenbrand <david@redhat.com>,
Dan Williams <dan.j.williams@intel.com>,
Borislav Petkov <bp@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Ingo Molnar <mingo@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Nadav Amit <namit@vmware.com>,
Wei Yang <richardw.yang@linux.intel.com>,
Oscar Salvador <osalvador@suse.de>,
Michal Hocko <mhocko@suse.com>
Subject: [PATCH v2 1/5] resource: Use PFN_UP / PFN_DOWN in walk_system_ram_range()
Date: Wed, 14 Aug 2019 17:41:05 +0200 [thread overview]
Message-ID: <20190814154109.3448-2-david@redhat.com> (raw)
In-Reply-To: <20190814154109.3448-1-david@redhat.com>
This makes it clearer that we will never call func() with duplicate PFNs
in case we have multiple sub-page memory resources. All unaligned parts
of PFNs are completely discarded.
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Nadav Amit <namit@vmware.com>
Cc: Wei Yang <richardw.yang@linux.intel.com>
Cc: Oscar Salvador <osalvador@suse.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
kernel/resource.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 7ea4306503c5..88ee39fa9103 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -487,8 +487,8 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
while (start < end &&
!find_next_iomem_res(start, end, flags, IORES_DESC_NONE,
false, &res)) {
- pfn = (res.start + PAGE_SIZE - 1) >> PAGE_SHIFT;
- end_pfn = (res.end + 1) >> PAGE_SHIFT;
+ pfn = PFN_UP(res.start);
+ end_pfn = PFN_DOWN(res.end + 1);
if (end_pfn > pfn)
ret = (*func)(pfn, end_pfn - pfn, arg);
if (ret)
--
2.21.0
next prev parent reply other threads:[~2019-08-14 15:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-14 15:41 [PATCH v2 0/5] mm/memory_hotplug: online_pages() cleanups David Hildenbrand
2019-08-14 15:41 ` David Hildenbrand [this message]
2019-08-14 16:15 ` [PATCH v2 1/5] resource: Use PFN_UP / PFN_DOWN in walk_system_ram_range() Wei Yang
2019-08-14 15:41 ` [PATCH v2 2/5] mm/memory_hotplug: Drop PageReserved() check in online_pages_range() David Hildenbrand
2019-08-14 16:04 ` Michal Hocko
2019-08-14 15:41 ` [PATCH v2 3/5] mm/memory_hotplug: Simplify online_pages_range() David Hildenbrand
2019-08-14 16:07 ` Michal Hocko
2019-08-14 15:41 ` [PATCH v2 4/5] mm/memory_hotplug: Make sure the pfn is aligned to the order when onlining David Hildenbrand
2019-08-14 16:09 ` David Hildenbrand
2019-08-14 18:32 ` Michal Hocko
2019-08-14 19:04 ` David Hildenbrand
2019-08-14 20:56 ` Andrew Morton
2019-08-14 21:47 ` David Hildenbrand
2019-08-14 22:10 ` Andrew Morton
2019-08-14 15:41 ` [PATCH v2 5/5] mm/memory_hotplug: online_pages cannot be 0 in online_pages() David Hildenbrand
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=20190814154109.3448-2-david@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=bp@suse.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=namit@vmware.com \
--cc=osalvador@suse.de \
--cc=richardw.yang@linux.intel.com \
/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).