Commit 0bf2edf
mm/page_alloc: reject unreasonable folio/compound page sizes in alloc_contig_range_noprof()
Let's reject them early, which in turn makes folio_alloc_gigantic() reject
them properly.
To avoid converting from order to nr_pages, let's just add MAX_FOLIO_ORDER
and calculate MAX_FOLIO_NR_PAGES based on that.
While at it, let's just make the order a "const unsigned order".
Link: https://lkml.kernel.org/r/20250901150359.867252-7-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Acked-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>1 parent 3b864c8 commit 0bf2edf
2 files changed
+13
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2055 | 2055 | | |
2056 | 2056 | | |
2057 | 2057 | | |
2058 | | - | |
| 2058 | + | |
2059 | 2059 | | |
2060 | | - | |
| 2060 | + | |
2061 | 2061 | | |
2062 | 2062 | | |
| 2063 | + | |
| 2064 | + | |
2063 | 2065 | | |
2064 | 2066 | | |
2065 | 2067 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6838 | 6838 | | |
6839 | 6839 | | |
6840 | 6840 | | |
| 6841 | + | |
6841 | 6842 | | |
6842 | 6843 | | |
6843 | 6844 | | |
| |||
6855 | 6856 | | |
6856 | 6857 | | |
6857 | 6858 | | |
| 6859 | + | |
| 6860 | + | |
| 6861 | + | |
| 6862 | + | |
| 6863 | + | |
| 6864 | + | |
| 6865 | + | |
| 6866 | + | |
6858 | 6867 | | |
6859 | 6868 | | |
6860 | 6869 | | |
| |||
6952 | 6961 | | |
6953 | 6962 | | |
6954 | 6963 | | |
6955 | | - | |
6956 | 6964 | | |
6957 | 6965 | | |
6958 | 6966 | | |
| |||
0 commit comments