mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
mm/khugepaged: use ALIGN helpers for PMD alignment
PMD alignment in khugepaged is currently implemented using a mix of rounding helpers and open-coded bitmask operations. Use ALIGN() and ALIGN_DOWN() consistently for PMD-sized address range alignment, matching the preferred style for address and size handling. No functional change intended. Link: https://lore.kernel.org/20260409014323.2385982-1-ye.liu@linux.dev Signed-off-by: Ye Liu <liuye@kylinos.cn> Reviewed-by: Zi Yan <ziy@nvidia.com> Reviewed-by: Barry Song <baohua@kernel.org> Reviewed-by: Lorenzo Stoakes <ljs@kernel.org> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: SeongJae Park <sj@kernel.org> Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Dev Jain <dev.jain@arm.com> Cc: Lance Yang <lance.yang@linux.dev> Cc: Liam Howlett <liam@infradead.org> Cc: Liu Ye <liuye@kylinos.cn> Cc: Nico Pache <npache@redhat.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
db5e2c01ca
commit
98e09ce7bb
|
|
@ -2528,8 +2528,8 @@ static void collapse_scan_mm_slot(unsigned int progress_max,
|
|||
cc->progress++;
|
||||
continue;
|
||||
}
|
||||
hstart = round_up(vma->vm_start, HPAGE_PMD_SIZE);
|
||||
hend = round_down(vma->vm_end, HPAGE_PMD_SIZE);
|
||||
hstart = ALIGN(vma->vm_start, HPAGE_PMD_SIZE);
|
||||
hend = ALIGN_DOWN(vma->vm_end, HPAGE_PMD_SIZE);
|
||||
if (khugepaged_scan.address > hend) {
|
||||
cc->progress++;
|
||||
continue;
|
||||
|
|
@ -2845,8 +2845,8 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start,
|
|||
mmgrab(mm);
|
||||
lru_add_drain_all();
|
||||
|
||||
hstart = (start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
|
||||
hend = end & HPAGE_PMD_MASK;
|
||||
hstart = ALIGN(start, HPAGE_PMD_SIZE);
|
||||
hend = ALIGN_DOWN(end, HPAGE_PMD_SIZE);
|
||||
|
||||
for (addr = hstart; addr < hend; addr += HPAGE_PMD_SIZE) {
|
||||
enum scan_result result = SCAN_FAIL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user