Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1563152
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v3 04/12] mm: introduce common definitions for the size and mask of a section |
| Date | 2017-01-19 23:30 +0100 |
| Message-ID | <t1tnr-7pp-19@gated-at.bofh.it> (permalink) |
| References | <t1tdM-7m6-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Up-level the local section size and mask from kernel/memremap.c to
global definitions. These will be used by the new sub-section hotplug
support.
Cc: Michal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Stephen Bates <stephen.bates@microsemi.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
include/linux/mmzone.h | 2 ++
kernel/memremap.c | 10 ++++------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 18cc15b93d19..aa37e2e860ed 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1048,6 +1048,8 @@ static inline unsigned long early_pfn_to_nid(unsigned long pfn)
* PFN_SECTION_SHIFT pfn to/from section number
*/
#define PA_SECTION_SHIFT (SECTION_SIZE_BITS)
+#define PA_SECTION_SIZE (1UL << PA_SECTION_SHIFT)
+#define PA_SECTION_MASK (~(PA_SECTION_SIZE-1))
#define PFN_SECTION_SHIFT (SECTION_SIZE_BITS - PAGE_SHIFT)
#define NR_MEM_SECTIONS (1UL << SECTIONS_SHIFT)
diff --git a/kernel/memremap.c b/kernel/memremap.c
index e0a2de6a168b..e58d7828ff9a 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -172,8 +172,6 @@ EXPORT_SYMBOL(devm_memunmap);
#ifdef CONFIG_ZONE_DEVICE
static DEFINE_MUTEX(pgmap_lock);
static RADIX_TREE(pgmap_radix, GFP_KERNEL);
-#define SECTION_MASK ~((1UL << PA_SECTION_SHIFT) - 1)
-#define SECTION_SIZE (1UL << PA_SECTION_SHIFT)
struct page_map {
struct resource res;
@@ -267,8 +265,8 @@ static void devm_memremap_pages_release(struct device *dev, void *data)
}
/* pages are dead and unused, undo the arch mapping */
- align_start = res->start & ~(SECTION_SIZE - 1);
- align_size = ALIGN(resource_size(res), SECTION_SIZE);
+ align_start = res->start & PA_SECTION_MASK;
+ align_size = ALIGN(resource_size(res), PA_SECTION_SIZE);
mem_hotplug_begin();
arch_remove_memory(align_start, align_size);
mem_hotplug_done();
@@ -314,8 +312,8 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
struct page_map *page_map;
int error, nid, is_ram;
- align_start = res->start & ~(SECTION_SIZE - 1);
- align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
+ align_start = res->start & PA_SECTION_MASK;
+ align_size = ALIGN(res->start + resource_size(res), PA_SECTION_SIZE)
- align_start;
is_ram = region_intersects(align_start, align_size,
IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 00/12] mm: sub-section memory hotplug support Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
[PATCH v3 10/12] mm: support section-unaligned ZONE_DEVICE memory ranges Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
[PATCH v3 04/12] mm: introduce common definitions for the size and mask of a section Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
[PATCH v3 05/12] mm: cleanup sparse_init_one_section() return value Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
[PATCH v3 06/12] mm: track active portions of a section at boot Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
Re: [PATCH v3 06/12] mm: track active portions of a section at boot Andrew Morton <akpm@linux-foundation.org> - 2017-01-20 01:20 +0100
Re: [PATCH v3 06/12] mm: track active portions of a section at boot Dan Williams <dan.j.williams@intel.com> - 2017-01-20 19:00 +0100
[PATCH v3 09/12] mm: prepare for hot-{add, remove} of sub-section ranges Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
[PATCH v3 08/12] mm: convert kmalloc_section_memmap() to populate_section_memmap() Dan Williams <dan.j.williams@intel.com> - 2017-01-19 23:30 +0100
csiph-web