Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/madvise: remove len parameter of madvise_do_behavior()

Because madise_should_skip() logic is factored out, making
madvise_do_behavior() calculates 'len' on its own rather then receiving it
as a parameter makes code simpler. Remove the parameter.

Link: https://lkml.kernel.org/r/20250312164750.59215-5-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Shakeel Butt <shakeel.butt@linux.dev>
Cc: David Hildenbrand <david@redhat.com>
Cc: Liam R. Howlett <howlett@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
be9258a6 0a6ffacb

+4 -6
+4 -6
mm/madvise.c
··· 1677 1677 } 1678 1678 1679 1679 static int madvise_do_behavior(struct mm_struct *mm, 1680 - unsigned long start, size_t len_in, size_t len, int behavior) 1680 + unsigned long start, size_t len_in, int behavior) 1681 1681 { 1682 1682 struct blk_plug plug; 1683 1683 unsigned long end; ··· 1686 1686 if (is_memory_failure(behavior)) 1687 1687 return madvise_inject_error(behavior, start, start + len_in); 1688 1688 start = untagged_addr_remote(mm, start); 1689 - end = start + len; 1689 + end = start + PAGE_ALIGN(len_in); 1690 1690 1691 1691 blk_start_plug(&plug); 1692 1692 if (is_madvise_populate(behavior)) ··· 1779 1779 error = madvise_lock(mm, behavior); 1780 1780 if (error) 1781 1781 return error; 1782 - error = madvise_do_behavior(mm, start, len_in, PAGE_ALIGN(len_in), 1783 - behavior); 1782 + error = madvise_do_behavior(mm, start, len_in, behavior); 1784 1783 madvise_unlock(mm, behavior); 1785 1784 1786 1785 return error; ··· 1811 1812 if (madvise_should_skip(start, len_in, behavior, &error)) 1812 1813 ret = error; 1813 1814 else 1814 - ret = madvise_do_behavior(mm, start, len_in, 1815 - PAGE_ALIGN(len_in), behavior); 1815 + ret = madvise_do_behavior(mm, start, len_in, behavior); 1816 1816 /* 1817 1817 * An madvise operation is attempting to restart the syscall, 1818 1818 * but we cannot proceed as it would not be correct to repeat