History

Merge tag 'mm-hotfixes-stable-2026-07-06-17-49' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull misc fixes from Andrew Morton: "20 hotfixes. 17 are for MM. 12 are cc:stable and the remaining 8 address post-7.1 issues or aren't considered suitable for backporting. Two patches from SJ addresses a couple of quite old DAMON issues. And two patches from Yichong Chen fixes tools/virtio build issues. The remaining patches are singletons" * tag 'mm-hotfixes-stable-2026-07-06-17-49' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: tools/include: include stdint.h for SIZE_MAX in overflow.h tools/virtio: add missing compat definitions for vhost_net_test mm: do file ownership checks with the proper mount idmap samples/damon/mtier: fail early if address range parameters are invalid mm: a second pagecache maintainer mm/damon: add a kernel-doc comment for damon_ctx->rnd_state mm/damon: add a kernel-doc comment for damon_ctx->probes mailmap: add entries for Radu Rendec selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE selftests/mm: pagemap_ioctl: use the correct page size for transact_test() fs/proc: fix KPF_KSM reported for all anonymous pages mm: page_ext: add count limit to page_ext_iter_next to prevent invalid PFN access mm/damon/ops-common: handle extreme intervals in damon_hot_score() MAINTAINERS: add Lance as an rmap reviewer mm/compaction: handle free_pages_prepare() properly in compaction_free() mm/damon/sysfs-schemes: put stats for scheme_add_dirs() internal error mm/damon/sysfs-schemes: fix dir put orders in access_pattern_add_dirs() mm: shrinker: fix NULL pointer dereference in debugfs mm: shrinker: fix shrinker_info teardown race with expansion selftests/mm: fix ksft_process_madv.sh test category

Linus Torvalds committed 4 months ago

Commit 0e35b9b2 parents cead34a 039892c25 files · +187 −43Browse files

Showing the changes to include/linux (3 of 25 files). Show all

Unified · Split

3 files
  1. include/linux/damon.h +8 −3
  2. include/linux/fs.h +5 −0
  3. include/linux/page_ext.h +13 −6
include/linux/damon.h+8−3
@@ -843,11 +843,13 @@ struct damon_attrs { · 842 unmodified lines
843843 * including damon_call() and damos_walk().
844844 *
845845 * @ops: Set of monitoring operations for given use cases.
846+ * @probes: Head of probes (&damon_probe) list.
846847 * @addr_unit: Scale factor for core to ops address conversion.
847848 * @min_region_sz: Minimum region size.
848849 * @pause: Pause kdamond main loop.
849850 * @adaptive_targets: Head of monitoring targets (&damon_target) list.
850851 * @schemes: Head of schemes (&damos) list.
852+ * @rnd_state: Per-ctx PRNG state for damon_rand().
851853 */
852854 struct damon_ctx {
853855 struct damon_attrs attrs;
@@ -905,7 +907,6 @@ struct damon_ctx { · 51 unmodified lines
905907 struct list_head adaptive_targets;
906908 struct list_head schemes;
907909
908− /* Per-ctx PRNG state for damon_rand(); kdamond is the sole consumer. */
909910 struct rnd_state rnd_state;
910911 };
911912
@@ -1065,9 +1066,13 @@ static inline bool damon_target_has_pid(const struct damon_ctx *ctx) · 153 unmodified lines
10651066
10661067 static inline unsigned int damon_max_nr_accesses(const struct damon_attrs *attrs)
10671068 {
1068− /* {aggr,sample}_interval are unsigned long, hence could overflow */
1069− return min(attrs->aggr_interval / attrs->sample_interval,
1069+ unsigned long sample_interval;
1070+ unsigned long max_nr_accesses;
1071+
1072+ sample_interval = attrs->sample_interval ? : 1;
1073+ max_nr_accesses = min(attrs->aggr_interval / sample_interval,
10701074 (unsigned long)UINT_MAX);
1075+ return max_nr_accesses ? : 1;
10711076 }
10721077
10731078
include/linux/fs.h+5−0
@@ -2444,6 +2444,11 @@ static inline struct mnt_idmap *file_mnt_idmap(const struct file *file) · 2443 unmodified lines
24442444 return mnt_idmap(file->f_path.mnt);
24452445 }
24462446
2447+static inline bool file_owner_or_capable(const struct file *file)
2448+{
2449+ return inode_owner_or_capable(file_mnt_idmap(file), file_inode(file));
2450+}
2451+
24472452 /**
24482453 * is_idmapped_mnt - check whether a mount is mapped
24492454 * @mnt: the mount to check
include/linux/page_ext.h+13−6
@@ -120,14 +120,18 @@ struct page_ext_iter { · 119 unmodified lines
120120 * page_ext_iter_begin() - Prepare for iterating through page extensions.
121121 * @iter: page extension iterator.
122122 * @pfn: PFN of the page we're interested in.
123+ * @count: maximum number of page extensions to return.
123124 *
124125 * Must be called with RCU read lock taken.
125126 *
126127 * Return: NULL if no page_ext exists for this page.
127128 */
128129 static inline struct page_ext *page_ext_iter_begin(struct page_ext_iter *iter,
129− unsigned long pfn)
130+ unsigned long pfn, unsigned long count)
130131 {
132+ if (!count)
133+ return NULL;
134+
131135 iter->index = 0;
132136 iter->start_pfn = pfn;
133137 iter->page_ext = page_ext_lookup(pfn);
@@ -138,19 +142,22 @@ static inline struct page_ext *page_ext_iter_begin(struct page_ext_iter *iter, · 4 unmodified lines
138142 /**
139143 * page_ext_iter_next() - Get next page extension
140144 * @iter: page extension iterator.
145+ * @count: maximum number of page extensions to return.
141146 *
142147 * Must be called with RCU read lock taken.
143148 *
144149 * Return: NULL if no next page_ext exists.
145150 */
146−static inline struct page_ext *page_ext_iter_next(struct page_ext_iter *iter)
151+static inline struct page_ext *page_ext_iter_next(struct page_ext_iter *iter,
152+ unsigned long count)
147153 {
148154 unsigned long pfn;
149155
150156 if (WARN_ON_ONCE(!iter->page_ext))
151157 return NULL;
152158
153− iter->index++;
159+ if (++iter->index >= count)
160+ return NULL;
154161 pfn = iter->start_pfn + iter->index;
155162
156163 if (page_ext_iter_next_fast_possible(pfn))
@@ -183,9 +190,9 @@ static inline struct page_ext *page_ext_iter_get(const struct page_ext_iter *ite · 26 unmodified lines
183190 * IMPORTANT: must be called with RCU read lock taken.
184191 */
185192 #define for_each_page_ext(__page, __pgcount, __page_ext, __iter) \
186− for (__page_ext = page_ext_iter_begin(&__iter, page_to_pfn(__page));\
187− __page_ext && __iter.index < __pgcount; \
188− __page_ext = page_ext_iter_next(&__iter))
193+ for (__page_ext = page_ext_iter_begin(&__iter, page_to_pfn(__page), __pgcount); \
194+ __page_ext; \
195+ __page_ext = page_ext_iter_next(&__iter, __pgcount))
189196
190197 #else /* !CONFIG_PAGE_EXTENSION */
191198 struct page_ext;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t