Commit 4ddb4d9
hugetlb: do not update address in huge_pmd_unshare
As an optimization for loops sequentially processing hugetlb address
ranges, huge_pmd_unshare would update a passed address if it unshared a
pmd. Updating a loop control variable outside the loop like this is
generally a bad idea. These loops are now using hugetlb_mask_last_page to
optimize scanning when non-present ptes are discovered. The same can be
done when huge_pmd_unshare returns 1 indicating a pmd was unshared.
Remove address update from huge_pmd_unshare. Change the passed argument
type and update all callers. In loops sequentially processing addresses
use hugetlb_mask_last_page to update address if pmd is unshared.
[sfr@canb.auug.org.au: fix an unused variable warning/error]
Link: https://lkml.kernel.org/r/20220622171117.70850960@canb.auug.org.au
Link: https://lkml.kernel.org/r/20220621235620.291305-4-mike.kravetz@oracle.com
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: James Houghton <jthoughton@google.com>
Cc: kernel test robot <lkp@intel.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Naoya Horiguchi <naoya.horiguchi@linux.dev>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
Cc: Will Deacon <will@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 1bcdb76 commit 4ddb4d9
3 files changed
+21
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4935 | 4935 | | |
4936 | 4936 | | |
4937 | 4937 | | |
4938 | | - | |
4939 | 4938 | | |
4940 | 4939 | | |
4941 | 4940 | | |
| |||
4963 | 4962 | | |
4964 | 4963 | | |
4965 | 4964 | | |
4966 | | - | |
4967 | | - | |
4968 | | - | |
4969 | | - | |
4970 | | - | |
4971 | | - | |
4972 | | - | |
| 4965 | + | |
4973 | 4966 | | |
| 4967 | + | |
| 4968 | + | |
4974 | 4969 | | |
4975 | 4970 | | |
4976 | 4971 | | |
| |||
5035 | 5030 | | |
5036 | 5031 | | |
5037 | 5032 | | |
5038 | | - | |
| 5033 | + | |
5039 | 5034 | | |
5040 | 5035 | | |
5041 | 5036 | | |
| 5037 | + | |
5042 | 5038 | | |
5043 | 5039 | | |
5044 | 5040 | | |
| |||
6327 | 6323 | | |
6328 | 6324 | | |
6329 | 6325 | | |
6330 | | - | |
| 6326 | + | |
6331 | 6327 | | |
6332 | 6328 | | |
6333 | 6329 | | |
| |||
6337 | 6333 | | |
6338 | 6334 | | |
6339 | 6335 | | |
| 6336 | + | |
6340 | 6337 | | |
6341 | 6338 | | |
6342 | 6339 | | |
| |||
6759 | 6756 | | |
6760 | 6757 | | |
6761 | 6758 | | |
6762 | | - | |
| 6759 | + | |
6763 | 6760 | | |
6764 | | - | |
6765 | | - | |
6766 | | - | |
| 6761 | + | |
| 6762 | + | |
| 6763 | + | |
6767 | 6764 | | |
6768 | 6765 | | |
6769 | 6766 | | |
| |||
6773 | 6770 | | |
6774 | 6771 | | |
6775 | 6772 | | |
6776 | | - | |
6777 | | - | |
6778 | | - | |
6779 | | - | |
6780 | | - | |
6781 | | - | |
6782 | | - | |
6783 | | - | |
6784 | 6773 | | |
6785 | 6774 | | |
6786 | 6775 | | |
| |||
6792 | 6781 | | |
6793 | 6782 | | |
6794 | 6783 | | |
6795 | | - | |
| 6784 | + | |
6796 | 6785 | | |
6797 | 6786 | | |
6798 | 6787 | | |
| |||
6899 | 6888 | | |
6900 | 6889 | | |
6901 | 6890 | | |
| 6891 | + | |
| 6892 | + | |
| 6893 | + | |
| 6894 | + | |
6902 | 6895 | | |
6903 | 6896 | | |
6904 | 6897 | | |
| |||
7125 | 7118 | | |
7126 | 7119 | | |
7127 | 7120 | | |
7128 | | - | |
7129 | | - | |
7130 | 7121 | | |
7131 | 7122 | | |
7132 | 7123 | | |
7133 | 7124 | | |
7134 | | - | |
7135 | | - | |
| 7125 | + | |
7136 | 7126 | | |
7137 | 7127 | | |
7138 | 7128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1559 | 1559 | | |
1560 | 1560 | | |
1561 | 1561 | | |
1562 | | - | |
| 1562 | + | |
1563 | 1563 | | |
1564 | 1564 | | |
1565 | 1565 | | |
| |||
1920 | 1920 | | |
1921 | 1921 | | |
1922 | 1922 | | |
1923 | | - | |
| 1923 | + | |
1924 | 1924 | | |
1925 | 1925 | | |
1926 | 1926 | | |
| |||
0 commit comments