mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
Subsystems (2)
PATCH 1/1 mm/memory_hotplug: use "unsigned long" for PFN in zone_for_pfn_range()
In reply to a message not in the archivecommit 7cf209ba8a86410939a24cb1aeb279479a7e0ca6 upstream.
Patch series "mm/memory_hotplug: preparatory patches for new online policy and memory"
These are all cleanups and one fix previously sent as part of [1]:
[PATCH v1 00/12] mm/memory_hotplug: "auto-movable" online policy and memory groups.
These patches make sense even without the other series, therefore I pulled them out to make the other series easier to digest.
[1] https://lkml.kernel.org/r/[email protected]
This patch (of 4):
Checkpatch complained on a follow-up patch that we are using "unsigned" here, which defaults to "unsigned int" and checkpatch is correct.
As we will search for a fitting zone using the wrong pfn, we might end up onlining memory to one of the special kernel zones, such as ZONE_DMA, which can end badly as the onlined memory does not satisfy properties of these zones.
Use "unsigned long" instead, just as we do in other places when handling PFNs. This can bite us once we have physical addresses in the range of multiple TB.
--- include/linux/memory_hotplug.h | 4 ++-- mm/memory_hotplug.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/memory_hotplug.h +2 -2
@@ -344,6 +344,6 @@ extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pnum);extern bool allow_online_pfn_range (int nid,unsigned long pfn,unsigned long nr_pages,int online_type); -extern struct zone *zone_for_pfn_range (int online_type,int nid,unsigned start_pfn, -unsigned long nr_pages); +extern struct zone *zone_for_pfn_range (int online_type,int nid, +unsigned long start_pfn,unsigned long nr_pages);#endif /* __LINUX_MEMORY_HOTPLUG_H */
mm/memory_hotplug.c +2 -2
@@ -783,8 +783,8 @@ static inline struct zone *default_zone_for_pfn(int nid, unsigned long start_pfnreturn movable_node_enabled ? movable_zone : kernel_zone; } -struct zone *zone_for_pfn_range (int online_type,int nid,unsigned start_pfn, -unsigned long nr_pages) +struct zone *zone_for_pfn_range (int online_type,int nid, +unsigned long start_pfn,unsigned long nr_pages) {if (online_type ==MMOP_ONLINE_KERNEL )return default_kernel_zone_for_pfn (nid, start_pfn, nr_pages);
Signature · 1 line
2.31.1
Greg KH
maintainerQuoted 2 lines · David Hildenbrand
commit
7cf209ba8a86410939a24cb1aeb279479a7e0ca6upstream.
We also need a 5.4.y version if we are going to be able to apply the 4.19.y and 4.14.y versions.
thanks,
greg k-h
Quoted 6 lines · Greg KH
Quoted 2 lines · David Hildenbrand
commit
7cf209ba8a86410939a24cb1aeb279479a7e0ca6upstream.We also need a 5.4.y version if we are going to be able to apply the 4.19.y and 4.14.y versions.
On it, still compiling :)
Signature · 3 lines
Thanks, David / dhildenb
Greg KH
maintainerQuoted 9 lines · David Hildenbrand
Quoted 6 lines · Greg KH
Quoted 2 lines · David Hildenbrand
commit
7cf209ba8a86410939a24cb1aeb279479a7e0ca6upstream.We also need a 5.4.y version if we are going to be able to apply the 4.19.y and 4.14.y versions.
On it, still compiling :)
Ah, thanks, all now queued up.
greg k-h