Skip to content

Commit 4d93978

Browse files
committed
Merge tag 'mm-hotfixes-stable-2024-10-17-16-08' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "28 hotfixes. 13 are cc:stable. 23 are MM. It is the usual shower of unrelated singletons - please see the individual changelogs for details" * tag 'mm-hotfixes-stable-2024-10-17-16-08' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (28 commits) maple_tree: add regression test for spanning store bug maple_tree: correct tree corruption on spanning store mm/mglru: only clear kswapd_failures if reclaimable mm/swapfile: skip HugeTLB pages for unuse_vma selftests: mm: fix the incorrect usage() info of khugepaged MAINTAINERS: add Jann as memory mapping/VMA reviewer mm: swap: prevent possible data-race in __try_to_reclaim_swap mm: khugepaged: fix the incorrect statistics when collapsing large file folios MAINTAINERS: kasan, kcov: add bugzilla links mm: don't install PMD mappings when THPs are disabled by the hw/process/vma mm: huge_memory: add vma_thp_disabled() and thp_disabled_by_hw() Docs/damon/maintainer-profile: update deprecated awslabs GitHub URLs Docs/damon/maintainer-profile: add missing '_' suffixes for external web links maple_tree: check for MA_STATE_BULK on setting wr_rebalance mm: khugepaged: fix the arguments order in khugepaged_collapse_file trace point mm/damon/tests/sysfs-kunit.h: fix memory leak in damon_sysfs_test_add_targets() mm: remove unused stub for can_swapin_thp() mailmap: add an entry for Andy Chiu MAINTAINERS: add memory mapping/VMA co-maintainers fs/proc: fix build with GCC 15 due to -Werror=unterminated-string-initialization ...
2 parents d4b82e5 + e993457 commit 4d93978

File tree

27 files changed

+309
-133
lines changed

27 files changed

+309
-133
lines changed

.mailmap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Andrey Ryabinin <[email protected]> <[email protected]>
7373
7474
7575
Andy Adamson <[email protected]>
76+
77+
7678
7779
7880

Documentation/mm/damon/maintainer-profile.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ The DAMON subsystem covers the files that are listed in 'DATA ACCESS MONITOR'
77
section of 'MAINTAINERS' file.
88

99
The mailing lists for the subsystem are [email protected] and
10-
[email protected]. Patches should be made against the mm-unstable `tree
11-
<https://git.kernel.org/akpm/mm/h/mm-unstable>` whenever possible and posted to
12-
the mailing lists.
10+
[email protected]. Patches should be made against the `mm-unstable tree
11+
<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ whenever possible and posted
12+
to the mailing lists.
1313

1414
SCM Trees
1515
---------
1616

1717
There are multiple Linux trees for DAMON development. Patches under
1818
development or testing are queued in `damon/next
19-
<https://git.kernel.org/sj/h/damon/next>` by the DAMON maintainer.
19+
<https://git.kernel.org/sj/h/damon/next>`_ by the DAMON maintainer.
2020
Sufficiently reviewed patches will be queued in `mm-unstable
21-
<https://git.kernel.org/akpm/mm/h/mm-unstable>` by the memory management
21+
<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ by the memory management
2222
subsystem maintainer. After more sufficient tests, the patches will be queued
23-
in `mm-stable <https://git.kernel.org/akpm/mm/h/mm-stable>` , and finally
23+
in `mm-stable <https://git.kernel.org/akpm/mm/h/mm-stable>`_, and finally
2424
pull-requested to the mainline by the memory management subsystem maintainer.
2525

26-
Note again the patches for mm-unstable `tree
27-
<https://git.kernel.org/akpm/mm/h/mm-unstable>` are queued by the memory
26+
Note again the patches for `mm-unstable tree
27+
<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ are queued by the memory
2828
management subsystem maintainer. If the patches requires some patches in
29-
damon/next `tree <https://git.kernel.org/sj/h/damon/next>` which not yet merged
29+
`damon/next tree <https://git.kernel.org/sj/h/damon/next>`_ which not yet merged
3030
in mm-unstable, please make sure the requirement is clearly specified.
3131

3232
Submit checklist addendum
@@ -37,25 +37,25 @@ When making DAMON changes, you should do below.
3737
- Build changes related outputs including kernel and documents.
3838
- Ensure the builds introduce no new errors or warnings.
3939
- Run and ensure no new failures for DAMON `selftests
40-
<https://github.com/awslabs/damon-tests/blob/master/corr/run.sh#L49>` and
40+
<https://github.com/damonitor/damon-tests/blob/master/corr/run.sh#L49>`_ and
4141
`kunittests
42-
<https://github.com/awslabs/damon-tests/blob/master/corr/tests/kunit.sh>`.
42+
<https://github.com/damonitor/damon-tests/blob/master/corr/tests/kunit.sh>`_.
4343

4444
Further doing below and putting the results will be helpful.
4545

4646
- Run `damon-tests/corr
47-
<https://github.com/awslabs/damon-tests/tree/master/corr>` for normal
47+
<https://github.com/damonitor/damon-tests/tree/master/corr>`_ for normal
4848
changes.
4949
- Run `damon-tests/perf
50-
<https://github.com/awslabs/damon-tests/tree/master/perf>` for performance
50+
<https://github.com/damonitor/damon-tests/tree/master/perf>`_ for performance
5151
changes.
5252

5353
Key cycle dates
5454
---------------
5555

5656
Patches can be sent anytime. Key cycle dates of the `mm-unstable
57-
<https://git.kernel.org/akpm/mm/h/mm-unstable>` and `mm-stable
58-
<https://git.kernel.org/akpm/mm/h/mm-stable>` trees depend on the memory
57+
<https://git.kernel.org/akpm/mm/h/mm-unstable>`_ and `mm-stable
58+
<https://git.kernel.org/akpm/mm/h/mm-stable>`_ trees depend on the memory
5959
management subsystem maintainer.
6060

6161
Review cadence
@@ -72,13 +72,13 @@ Mailing tool
7272
Like many other Linux kernel subsystems, DAMON uses the mailing lists
7373
([email protected] and [email protected]) as the major communication
7474
channel. There is a simple tool called `HacKerMaiL
75-
<https://github.com/damonitor/hackermail>` (``hkml``), which is for people who
75+
<https://github.com/damonitor/hackermail>`_ (``hkml``), which is for people who
7676
are not very familiar with the mailing lists based communication. The tool
7777
could be particularly helpful for DAMON community members since it is developed
7878
and maintained by DAMON maintainer. The tool is also officially announced to
7979
support DAMON and general Linux kernel development workflow.
8080

81-
In other words, `hkml <https://github.com/damonitor/hackermail>` is a mailing
81+
In other words, `hkml <https://github.com/damonitor/hackermail>`_ is a mailing
8282
tool for DAMON community, which DAMON maintainer is committed to support.
8383
Please feel free to try and report issues or feature requests for the tool to
8484
the maintainer.
@@ -98,8 +98,8 @@ slots, and attendees should reserve one of those at least 24 hours before the
9898
time slot, by reaching out to the maintainer.
9999

100100
Schedules and available reservation time slots are available at the Google `doc
101-
<https://docs.google.com/document/d/1v43Kcj3ly4CYqmAkMaZzLiM2GEnWfgdGbZAH3mi2vpM/edit?usp=sharing>`.
101+
<https://docs.google.com/document/d/1v43Kcj3ly4CYqmAkMaZzLiM2GEnWfgdGbZAH3mi2vpM/edit?usp=sharing>`_.
102102
There is also a public Google `calendar
103-
<https://calendar.google.com/calendar/u/0?cid=ZDIwOTA4YTMxNjc2MDQ3NTIyMmUzYTM5ZmQyM2U4NDA0ZGIwZjBiYmJlZGQxNDM0MmY4ZTRjOTE0NjdhZDRiY0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t>`
103+
<https://calendar.google.com/calendar/u/0?cid=ZDIwOTA4YTMxNjc2MDQ3NTIyMmUzYTM5ZmQyM2U4NDA0ZGIwZjBiYmJlZGQxNDM0MmY4ZTRjOTE0NjdhZDRiY0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t>`_
104104
that has the events. Anyone can subscribe it. DAMON maintainer will also
105105
provide periodic reminder to the mailing list ([email protected]).

MAINTAINERS

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12242,6 +12242,7 @@ R: Dmitry Vyukov <[email protected]>
1224212242
R: Vincenzo Frascino <[email protected]>
1224312243
1224412244
S: Maintained
12245+
B: https://bugzilla.kernel.org/buglist.cgi?component=Sanitizers&product=Memory%20Management
1224512246
F: Documentation/dev-tools/kasan.rst
1224612247
F: arch/*/include/asm/*kasan.h
1224712248
F: arch/*/mm/kasan_init*
@@ -12265,6 +12266,7 @@ R: Dmitry Vyukov <[email protected]>
1226512266
R: Andrey Konovalov <[email protected]>
1226612267
1226712268
S: Maintained
12269+
B: https://bugzilla.kernel.org/buglist.cgi?component=Sanitizers&product=Memory%20Management
1226812270
F: Documentation/dev-tools/kcov.rst
1226912271
F: include/linux/kcov.h
1227012272
F: include/uapi/linux/kcov.h
@@ -14907,9 +14909,10 @@ N: include/linux/page[-_]*
1490714909

1490814910
MEMORY MAPPING
1490914911
M: Andrew Morton <[email protected]>
14910-
R: Liam R. Howlett <[email protected]>
14912+
M: Liam R. Howlett <[email protected]>
14913+
M: Lorenzo Stoakes <[email protected]>
1491114914
R: Vlastimil Babka <[email protected]>
14912-
R: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
14915+
R: Jann Horn <jannh@google.com>
1491314916
1491414917
S: Maintained
1491514918
W: http://www.linux-mm.org
@@ -24738,9 +24741,10 @@ F: tools/testing/vsock/
2473824741

2473924742
VMA
2474024743
M: Andrew Morton <[email protected]>
24741-
R: Liam R. Howlett <[email protected]>
24744+
M: Liam R. Howlett <[email protected]>
24745+
M: Lorenzo Stoakes <[email protected]>
2474224746
R: Vlastimil Babka <[email protected]>
24743-
R: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
24747+
R: Jann Horn <jannh@google.com>
2474424748
2474524749
S: Maintained
2474624750
W: https://www.linux-mm.org

fs/fat/namei_vfat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ static int vfat_rename(struct inode *old_dir, struct dentry *old_dentry,
10371037
if (corrupt < 0) {
10381038
fat_fs_error(new_dir->i_sb,
10391039
"%s: Filesystem corrupted (i_pos %lld)",
1040-
__func__, sinfo.i_pos);
1040+
__func__, new_i_pos);
10411041
}
10421042
goto out;
10431043
}

fs/nilfs2/dir.c

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static int nilfs_readdir(struct file *file, struct dir_context *ctx)
289289
* The folio is mapped and unlocked. When the caller is finished with
290290
* the entry, it should call folio_release_kmap().
291291
*
292-
* On failure, returns NULL and the caller should ignore foliop.
292+
* On failure, returns an error pointer and the caller should ignore foliop.
293293
*/
294294
struct nilfs_dir_entry *nilfs_find_entry(struct inode *dir,
295295
const struct qstr *qstr, struct folio **foliop)
@@ -312,22 +312,24 @@ struct nilfs_dir_entry *nilfs_find_entry(struct inode *dir,
312312
do {
313313
char *kaddr = nilfs_get_folio(dir, n, foliop);
314314

315-
if (!IS_ERR(kaddr)) {
316-
de = (struct nilfs_dir_entry *)kaddr;
317-
kaddr += nilfs_last_byte(dir, n) - reclen;
318-
while ((char *) de <= kaddr) {
319-
if (de->rec_len == 0) {
320-
nilfs_error(dir->i_sb,
321-
"zero-length directory entry");
322-
folio_release_kmap(*foliop, kaddr);
323-
goto out;
324-
}
325-
if (nilfs_match(namelen, name, de))
326-
goto found;
327-
de = nilfs_next_entry(de);
315+
if (IS_ERR(kaddr))
316+
return ERR_CAST(kaddr);
317+
318+
de = (struct nilfs_dir_entry *)kaddr;
319+
kaddr += nilfs_last_byte(dir, n) - reclen;
320+
while ((char *)de <= kaddr) {
321+
if (de->rec_len == 0) {
322+
nilfs_error(dir->i_sb,
323+
"zero-length directory entry");
324+
folio_release_kmap(*foliop, kaddr);
325+
goto out;
328326
}
329-
folio_release_kmap(*foliop, kaddr);
327+
if (nilfs_match(namelen, name, de))
328+
goto found;
329+
de = nilfs_next_entry(de);
330330
}
331+
folio_release_kmap(*foliop, kaddr);
332+
331333
if (++n >= npages)
332334
n = 0;
333335
/* next folio is past the blocks we've got */
@@ -340,7 +342,7 @@ struct nilfs_dir_entry *nilfs_find_entry(struct inode *dir,
340342
}
341343
} while (n != start);
342344
out:
343-
return NULL;
345+
return ERR_PTR(-ENOENT);
344346

345347
found:
346348
ei->i_dir_start_lookup = n;
@@ -384,18 +386,18 @@ struct nilfs_dir_entry *nilfs_dotdot(struct inode *dir, struct folio **foliop)
384386
return NULL;
385387
}
386388

387-
ino_t nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr)
389+
int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr, ino_t *ino)
388390
{
389-
ino_t res = 0;
390391
struct nilfs_dir_entry *de;
391392
struct folio *folio;
392393

393394
de = nilfs_find_entry(dir, qstr, &folio);
394-
if (de) {
395-
res = le64_to_cpu(de->inode);
396-
folio_release_kmap(folio, de);
397-
}
398-
return res;
395+
if (IS_ERR(de))
396+
return PTR_ERR(de);
397+
398+
*ino = le64_to_cpu(de->inode);
399+
folio_release_kmap(folio, de);
400+
return 0;
399401
}
400402

401403
void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,

fs/nilfs2/namei.c

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,20 @@ nilfs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
5555
{
5656
struct inode *inode;
5757
ino_t ino;
58+
int res;
5859

5960
if (dentry->d_name.len > NILFS_NAME_LEN)
6061
return ERR_PTR(-ENAMETOOLONG);
6162

62-
ino = nilfs_inode_by_name(dir, &dentry->d_name);
63-
inode = ino ? nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root, ino) : NULL;
63+
res = nilfs_inode_by_name(dir, &dentry->d_name, &ino);
64+
if (res) {
65+
if (res != -ENOENT)
66+
return ERR_PTR(res);
67+
inode = NULL;
68+
} else {
69+
inode = nilfs_iget(dir->i_sb, NILFS_I(dir)->i_root, ino);
70+
}
71+
6472
return d_splice_alias(inode, dentry);
6573
}
6674

@@ -263,10 +271,11 @@ static int nilfs_do_unlink(struct inode *dir, struct dentry *dentry)
263271
struct folio *folio;
264272
int err;
265273

266-
err = -ENOENT;
267274
de = nilfs_find_entry(dir, &dentry->d_name, &folio);
268-
if (!de)
275+
if (IS_ERR(de)) {
276+
err = PTR_ERR(de);
269277
goto out;
278+
}
270279

271280
inode = d_inode(dentry);
272281
err = -EIO;
@@ -362,10 +371,11 @@ static int nilfs_rename(struct mnt_idmap *idmap,
362371
if (unlikely(err))
363372
return err;
364373

365-
err = -ENOENT;
366374
old_de = nilfs_find_entry(old_dir, &old_dentry->d_name, &old_folio);
367-
if (!old_de)
375+
if (IS_ERR(old_de)) {
376+
err = PTR_ERR(old_de);
368377
goto out;
378+
}
369379

370380
if (S_ISDIR(old_inode->i_mode)) {
371381
err = -EIO;
@@ -382,10 +392,12 @@ static int nilfs_rename(struct mnt_idmap *idmap,
382392
if (dir_de && !nilfs_empty_dir(new_inode))
383393
goto out_dir;
384394

385-
err = -ENOENT;
386-
new_de = nilfs_find_entry(new_dir, &new_dentry->d_name, &new_folio);
387-
if (!new_de)
395+
new_de = nilfs_find_entry(new_dir, &new_dentry->d_name,
396+
&new_folio);
397+
if (IS_ERR(new_de)) {
398+
err = PTR_ERR(new_de);
388399
goto out_dir;
400+
}
389401
nilfs_set_link(new_dir, new_de, new_folio, old_inode);
390402
folio_release_kmap(new_folio, new_de);
391403
nilfs_mark_inode_dirty(new_dir);
@@ -440,12 +452,13 @@ static int nilfs_rename(struct mnt_idmap *idmap,
440452
*/
441453
static struct dentry *nilfs_get_parent(struct dentry *child)
442454
{
443-
unsigned long ino;
455+
ino_t ino;
456+
int res;
444457
struct nilfs_root *root;
445458

446-
ino = nilfs_inode_by_name(d_inode(child), &dotdot_name);
447-
if (!ino)
448-
return ERR_PTR(-ENOENT);
459+
res = nilfs_inode_by_name(d_inode(child), &dotdot_name, &ino);
460+
if (res)
461+
return ERR_PTR(res);
449462

450463
root = NILFS_I(d_inode(child))->i_root;
451464

fs/nilfs2/nilfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static inline __u32 nilfs_mask_flags(umode_t mode, __u32 flags)
254254

255255
/* dir.c */
256256
int nilfs_add_link(struct dentry *, struct inode *);
257-
ino_t nilfs_inode_by_name(struct inode *, const struct qstr *);
257+
int nilfs_inode_by_name(struct inode *dir, const struct qstr *qstr, ino_t *ino);
258258
int nilfs_make_empty(struct inode *, struct inode *);
259259
struct nilfs_dir_entry *nilfs_find_entry(struct inode *, const struct qstr *,
260260
struct folio **);

fs/proc/task_mmu.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,15 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
909909
{
910910
/*
911911
* Don't forget to update Documentation/ on changes.
912+
*
913+
* The length of the second argument of mnemonics[]
914+
* needs to be 3 instead of previously set 2
915+
* (i.e. from [BITS_PER_LONG][2] to [BITS_PER_LONG][3])
916+
* to avoid spurious
917+
* -Werror=unterminated-string-initialization warning
918+
* with GCC 15
912919
*/
913-
static const char mnemonics[BITS_PER_LONG][2] = {
920+
static const char mnemonics[BITS_PER_LONG][3] = {
914921
/*
915922
* In case if we meet a flag we don't know about.
916923
*/
@@ -987,11 +994,8 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
987994
for (i = 0; i < BITS_PER_LONG; i++) {
988995
if (!mnemonics[i][0])
989996
continue;
990-
if (vma->vm_flags & (1UL << i)) {
991-
seq_putc(m, mnemonics[i][0]);
992-
seq_putc(m, mnemonics[i][1]);
993-
seq_putc(m, ' ');
994-
}
997+
if (vma->vm_flags & (1UL << i))
998+
seq_printf(m, "%s ", mnemonics[i]);
995999
}
9961000
seq_putc(m, '\n');
9971001
}

include/linux/huge_mm.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,24 @@ struct thpsize {
322322
(transparent_hugepage_flags & \
323323
(1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))
324324

325+
static inline bool vma_thp_disabled(struct vm_area_struct *vma,
326+
unsigned long vm_flags)
327+
{
328+
/*
329+
* Explicitly disabled through madvise or prctl, or some
330+
* architectures may disable THP for some mappings, for
331+
* example, s390 kvm.
332+
*/
333+
return (vm_flags & VM_NOHUGEPAGE) ||
334+
test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags);
335+
}
336+
337+
static inline bool thp_disabled_by_hw(void)
338+
{
339+
/* If the hardware/firmware marked hugepage support disabled. */
340+
return transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_UNSUPPORTED);
341+
}
342+
325343
unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
326344
unsigned long len, unsigned long pgoff, unsigned long flags);
327345
unsigned long thp_get_unmapped_area_vmflags(struct file *filp, unsigned long addr,

0 commit comments

Comments
 (0)