Skip to content

Commit d3d1556

Browse files
committed
Merge tag 'mm-hotfixes-stable-2024-10-09-15-46' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "12 hotfixes, 5 of which are c:stable. All singletons, about half of which are MM" * tag 'mm-hotfixes-stable-2024-10-09-15-46' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm: zswap: delete comments for "value" member of 'struct zswap_entry'. CREDITS: sort alphabetically by name secretmem: disable memfd_secret() if arch cannot set direct map .mailmap: update Fangrui's email mm/huge_memory: check pmd_special() only after pmd_present() resource, kunit: fix user-after-free in resource_test_region_intersects() fs/proc/kcore.c: allow translation of physical memory addresses selftests/mm: fix incorrect buffer->mirror size in hmm2 double_map test device-dax: correct pgoff align in dax_set_mapping() kthread: unpark only parked kthread Revert "mm: introduce PF_MEMALLOC_NORECLAIM, PF_MEMALLOC_NOWARN" bcachefs: do not use PF_MEMALLOC_NORECLAIM
2 parents b983b27 + aa5f0fa commit d3d1556

File tree

18 files changed

+117
-73
lines changed

18 files changed

+117
-73
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> <ezequiel@collabora.com>
203203
Faith Ekstrand <faith.ekstrand@collabora.com> <jason@jlekstrand.net>
204204
Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@intel.com>
205205
Faith Ekstrand <faith.ekstrand@collabora.com> <jason.ekstrand@collabora.com>
206+
Fangrui Song <i@maskray.me> <maskray@google.com>
206207
Felipe W Damasio <felipewd@terra.com.br>
207208
Felix Kuhling <fxkuehl@gmx.de>
208209
Felix Moeller <felix@derklecks.de>

CREDITS

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,10 +1358,6 @@ D: Major kbuild rework during the 2.5 cycle
13581358
D: ISDN Maintainer
13591359
S: USA
13601360

1361-
N: Gerrit Renker
1362-
E: gerrit@erg.abdn.ac.uk
1363-
D: DCCP protocol support.
1364-
13651361
N: Philip Gladstone
13661362
E: philip@gladstonefamily.net
13671363
D: Kernel / timekeeping stuff
@@ -1677,11 +1673,6 @@ W: http://www.carumba.com/
16771673
D: bug toaster (A1 sauce makes all the difference)
16781674
D: Random linux hacker
16791675

1680-
N: James Hogan
1681-
E: jhogan@kernel.org
1682-
D: Metag architecture maintainer
1683-
D: TZ1090 SoC maintainer
1684-
16851676
N: Tim Hockin
16861677
E: thockin@hockin.org
16871678
W: http://www.hockin.org/~thockin
@@ -1697,6 +1688,11 @@ D: hwmon subsystem maintainer
16971688
D: i2c-sis96x and i2c-stub SMBus drivers
16981689
S: USA
16991690

1691+
N: James Hogan
1692+
E: jhogan@kernel.org
1693+
D: Metag architecture maintainer
1694+
D: TZ1090 SoC maintainer
1695+
17001696
N: Dirk Hohndel
17011697
E: hohndel@suse.de
17021698
D: The XFree86[tm] Project
@@ -1872,6 +1868,10 @@ S: K osmidomkum 723
18721868
S: 160 00 Praha 6
18731869
S: Czech Republic
18741870

1871+
N: Seth Jennings
1872+
E: sjenning@redhat.com
1873+
D: Creation and maintenance of zswap
1874+
18751875
N: Jeremy Kerr
18761876
D: Maintainer of SPU File System
18771877

@@ -2188,19 +2188,6 @@ N: Mike Kravetz
21882188
E: mike.kravetz@oracle.com
21892189
D: Maintenance and development of the hugetlb subsystem
21902190

2191-
N: Seth Jennings
2192-
E: sjenning@redhat.com
2193-
D: Creation and maintenance of zswap
2194-
2195-
N: Dan Streetman
2196-
E: ddstreet@ieee.org
2197-
D: Maintenance and development of zswap
2198-
D: Creation and maintenance of the zpool API
2199-
2200-
N: Vitaly Wool
2201-
E: vitaly.wool@konsulko.com
2202-
D: Maintenance and development of zswap
2203-
22042191
N: Andreas S. Krebs
22052192
E: akrebs@altavista.net
22062193
D: CYPRESS CY82C693 chipset IDE, Digital's PC-Alpha 164SX boards
@@ -3191,6 +3178,11 @@ N: Ken Pizzini
31913178
E: ken@halcyon.com
31923179
D: CDROM driver "sonycd535" (Sony CDU-535/531)
31933180

3181+
N: Mathieu Poirier
3182+
E: mathieu.poirier@linaro.org
3183+
D: CoreSight kernel subsystem, Maintainer 2014-2022
3184+
D: Perf tool support for CoreSight
3185+
31943186
N: Stelian Pop
31953187
E: stelian@popies.net
31963188
P: 1024D/EDBB6147 7B36 0E07 04BC 11DC A7A0 D3F7 7185 9E7A EDBB 6147
@@ -3300,6 +3292,10 @@ S: Schlossbergring 9
33003292
S: 79098 Freiburg
33013293
S: Germany
33023294

3295+
N: Gerrit Renker
3296+
E: gerrit@erg.abdn.ac.uk
3297+
D: DCCP protocol support.
3298+
33033299
N: Thomas Renninger
33043300
E: trenn@suse.de
33053301
D: cpupowerutils
@@ -3576,11 +3572,6 @@ D: several improvements to system programs
35763572
S: Oldenburg
35773573
S: Germany
35783574

3579-
N: Mathieu Poirier
3580-
E: mathieu.poirier@linaro.org
3581-
D: CoreSight kernel subsystem, Maintainer 2014-2022
3582-
D: Perf tool support for CoreSight
3583-
35843575
N: Robert Schwebel
35853576
E: robert@schwebel.de
35863577
W: https://www.schwebel.de
@@ -3771,6 +3762,11 @@ S: Chr. Winthersvej 1 B, st.th.
37713762
S: DK-1860 Frederiksberg C
37723763
S: Denmark
37733764

3765+
N: Dan Streetman
3766+
E: ddstreet@ieee.org
3767+
D: Maintenance and development of zswap
3768+
D: Creation and maintenance of the zpool API
3769+
37743770
N: Drew Sullivan
37753771
E: drew@ss.org
37763772
W: http://www.ss.org/
@@ -4286,6 +4282,10 @@ S: Pipers Way
42864282
S: Swindon. SN3 1RJ
42874283
S: England
42884284

4285+
N: Vitaly Wool
4286+
E: vitaly.wool@konsulko.com
4287+
D: Maintenance and development of zswap
4288+
42894289
N: Chris Wright
42904290
E: chrisw@sous-sol.org
42914291
D: hacking on LSM framework and security modules.

arch/s390/include/asm/io.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
#include <asm/pci_io.h>
1717

1818
#define xlate_dev_mem_ptr xlate_dev_mem_ptr
19+
#define kc_xlate_dev_mem_ptr xlate_dev_mem_ptr
1920
void *xlate_dev_mem_ptr(phys_addr_t phys);
2021
#define unxlate_dev_mem_ptr unxlate_dev_mem_ptr
22+
#define kc_unxlate_dev_mem_ptr unxlate_dev_mem_ptr
2123
void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr);
2224

2325
#define IO_SPACE_LIMIT 0

drivers/dax/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static void dax_set_mapping(struct vm_fault *vmf, pfn_t pfn,
8686
nr_pages = 1;
8787

8888
pgoff = linear_page_index(vmf->vma,
89-
ALIGN(vmf->address, fault_size));
89+
ALIGN_DOWN(vmf->address, fault_size));
9090

9191
for (i = 0; i < nr_pages; i++) {
9292
struct page *page = pfn_to_page(pfn_t_to_pfn(pfn) + i);

fs/bcachefs/fs.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ static struct inode *bch2_alloc_inode(struct super_block *sb)
300300
BUG();
301301
}
302302

303-
static struct bch_inode_info *__bch2_new_inode(struct bch_fs *c)
303+
static struct bch_inode_info *__bch2_new_inode(struct bch_fs *c, gfp_t gfp)
304304
{
305305
struct bch_inode_info *inode = alloc_inode_sb(c->vfs_sb,
306-
bch2_inode_cache, GFP_NOFS);
306+
bch2_inode_cache, gfp);
307307
if (!inode)
308308
return NULL;
309309

@@ -315,7 +315,7 @@ static struct bch_inode_info *__bch2_new_inode(struct bch_fs *c)
315315
mutex_init(&inode->ei_quota_lock);
316316
memset(&inode->ei_devs_need_flush, 0, sizeof(inode->ei_devs_need_flush));
317317

318-
if (unlikely(inode_init_always(c->vfs_sb, &inode->v))) {
318+
if (unlikely(inode_init_always_gfp(c->vfs_sb, &inode->v, gfp))) {
319319
kmem_cache_free(bch2_inode_cache, inode);
320320
return NULL;
321321
}
@@ -328,12 +328,10 @@ static struct bch_inode_info *__bch2_new_inode(struct bch_fs *c)
328328
*/
329329
static struct bch_inode_info *bch2_new_inode(struct btree_trans *trans)
330330
{
331-
struct bch_inode_info *inode =
332-
memalloc_flags_do(PF_MEMALLOC_NORECLAIM|PF_MEMALLOC_NOWARN,
333-
__bch2_new_inode(trans->c));
331+
struct bch_inode_info *inode = __bch2_new_inode(trans->c, GFP_NOWAIT);
334332

335333
if (unlikely(!inode)) {
336-
int ret = drop_locks_do(trans, (inode = __bch2_new_inode(trans->c)) ? 0 : -ENOMEM);
334+
int ret = drop_locks_do(trans, (inode = __bch2_new_inode(trans->c, GFP_NOFS)) ? 0 : -ENOMEM);
337335
if (ret && inode) {
338336
__destroy_inode(&inode->v);
339337
kmem_cache_free(bch2_inode_cache, inode);
@@ -407,7 +405,7 @@ __bch2_create(struct mnt_idmap *idmap,
407405
if (ret)
408406
return ERR_PTR(ret);
409407
#endif
410-
inode = __bch2_new_inode(c);
408+
inode = __bch2_new_inode(c, GFP_NOFS);
411409
if (unlikely(!inode)) {
412410
inode = ERR_PTR(-ENOMEM);
413411
goto err;

fs/inode.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,16 @@ static int no_open(struct inode *inode, struct file *file)
146146
}
147147

148148
/**
149-
* inode_init_always - perform inode structure initialisation
149+
* inode_init_always_gfp - perform inode structure initialisation
150150
* @sb: superblock inode belongs to
151151
* @inode: inode to initialise
152+
* @gfp: allocation flags
152153
*
153154
* These are initializations that need to be done on every inode
154155
* allocation as the fields are not initialised by slab allocation.
156+
* If there are additional allocations required @gfp is used.
155157
*/
156-
int inode_init_always(struct super_block *sb, struct inode *inode)
158+
int inode_init_always_gfp(struct super_block *sb, struct inode *inode, gfp_t gfp)
157159
{
158160
static const struct inode_operations empty_iops;
159161
static const struct file_operations no_open_fops = {.open = no_open};
@@ -230,14 +232,14 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
230232
#endif
231233
inode->i_flctx = NULL;
232234

233-
if (unlikely(security_inode_alloc(inode)))
235+
if (unlikely(security_inode_alloc(inode, gfp)))
234236
return -ENOMEM;
235237

236238
this_cpu_inc(nr_inodes);
237239

238240
return 0;
239241
}
240-
EXPORT_SYMBOL(inode_init_always);
242+
EXPORT_SYMBOL(inode_init_always_gfp);
241243

242244
void free_inode_nonrcu(struct inode *inode)
243245
{

fs/proc/kcore.c

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ static struct proc_dir_entry *proc_root_kcore;
5050
#define kc_offset_to_vaddr(o) ((o) + PAGE_OFFSET)
5151
#endif
5252

53+
#ifndef kc_xlate_dev_mem_ptr
54+
#define kc_xlate_dev_mem_ptr kc_xlate_dev_mem_ptr
55+
static inline void *kc_xlate_dev_mem_ptr(phys_addr_t phys)
56+
{
57+
return __va(phys);
58+
}
59+
#endif
60+
#ifndef kc_unxlate_dev_mem_ptr
61+
#define kc_unxlate_dev_mem_ptr kc_unxlate_dev_mem_ptr
62+
static inline void kc_unxlate_dev_mem_ptr(phys_addr_t phys, void *virt)
63+
{
64+
}
65+
#endif
66+
5367
static LIST_HEAD(kclist_head);
5468
static DECLARE_RWSEM(kclist_lock);
5569
static int kcore_need_update = 1;
@@ -471,6 +485,8 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
471485
while (buflen) {
472486
struct page *page;
473487
unsigned long pfn;
488+
phys_addr_t phys;
489+
void *__start;
474490

475491
/*
476492
* If this is the first iteration or the address is not within
@@ -537,7 +553,8 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
537553
}
538554
break;
539555
case KCORE_RAM:
540-
pfn = __pa(start) >> PAGE_SHIFT;
556+
phys = __pa(start);
557+
pfn = phys >> PAGE_SHIFT;
541558
page = pfn_to_online_page(pfn);
542559

543560
/*
@@ -557,13 +574,28 @@ static ssize_t read_kcore_iter(struct kiocb *iocb, struct iov_iter *iter)
557574
fallthrough;
558575
case KCORE_VMEMMAP:
559576
case KCORE_TEXT:
577+
if (m->type == KCORE_RAM) {
578+
__start = kc_xlate_dev_mem_ptr(phys);
579+
if (!__start) {
580+
ret = -ENOMEM;
581+
if (iov_iter_zero(tsz, iter) != tsz)
582+
ret = -EFAULT;
583+
goto out;
584+
}
585+
} else {
586+
__start = (void *)start;
587+
}
588+
560589
/*
561590
* Sadly we must use a bounce buffer here to be able to
562591
* make use of copy_from_kernel_nofault(), as these
563592
* memory regions might not always be mapped on all
564593
* architectures.
565594
*/
566-
if (copy_from_kernel_nofault(buf, (void *)start, tsz)) {
595+
ret = copy_from_kernel_nofault(buf, __start, tsz);
596+
if (m->type == KCORE_RAM)
597+
kc_unxlate_dev_mem_ptr(phys, __start);
598+
if (ret) {
567599
if (iov_iter_zero(tsz, iter) != tsz) {
568600
ret = -EFAULT;
569601
goto out;

include/linux/fs.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3082,7 +3082,12 @@ extern loff_t default_llseek(struct file *file, loff_t offset, int whence);
30823082

30833083
extern loff_t vfs_llseek(struct file *file, loff_t offset, int whence);
30843084

3085-
extern int inode_init_always(struct super_block *, struct inode *);
3085+
extern int inode_init_always_gfp(struct super_block *, struct inode *, gfp_t);
3086+
static inline int inode_init_always(struct super_block *sb, struct inode *inode)
3087+
{
3088+
return inode_init_always_gfp(sb, inode, GFP_NOFS);
3089+
}
3090+
30863091
extern void inode_init_once(struct inode *);
30873092
extern void address_space_init_once(struct address_space *mapping);
30883093
extern struct inode * igrab(struct inode *);

include/linux/sched.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,8 @@ extern struct pid *cad_pid;
16811681
* I am cleaning dirty pages from some other bdi. */
16821682
#define PF_KTHREAD 0x00200000 /* I am a kernel thread */
16831683
#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */
1684-
#define PF_MEMALLOC_NORECLAIM 0x00800000 /* All allocation requests will clear __GFP_DIRECT_RECLAIM */
1685-
#define PF_MEMALLOC_NOWARN 0x01000000 /* All allocation requests will inherit __GFP_NOWARN */
1684+
#define PF__HOLE__00800000 0x00800000
1685+
#define PF__HOLE__01000000 0x01000000
16861686
#define PF__HOLE__02000000 0x02000000
16871687
#define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */
16881688
#define PF_MCE_EARLY 0x08000000 /* Early kill for mce process policy */

include/linux/sched/mm.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,25 +251,16 @@ static inline gfp_t current_gfp_context(gfp_t flags)
251251
{
252252
unsigned int pflags = READ_ONCE(current->flags);
253253

254-
if (unlikely(pflags & (PF_MEMALLOC_NOIO |
255-
PF_MEMALLOC_NOFS |
256-
PF_MEMALLOC_NORECLAIM |
257-
PF_MEMALLOC_NOWARN |
258-
PF_MEMALLOC_PIN))) {
254+
if (unlikely(pflags & (PF_MEMALLOC_NOIO | PF_MEMALLOC_NOFS | PF_MEMALLOC_PIN))) {
259255
/*
260-
* Stronger flags before weaker flags:
261-
* NORECLAIM implies NOIO, which in turn implies NOFS
256+
* NOIO implies both NOIO and NOFS and it is a weaker context
257+
* so always make sure it makes precedence
262258
*/
263-
if (pflags & PF_MEMALLOC_NORECLAIM)
264-
flags &= ~__GFP_DIRECT_RECLAIM;
265-
else if (pflags & PF_MEMALLOC_NOIO)
259+
if (pflags & PF_MEMALLOC_NOIO)
266260
flags &= ~(__GFP_IO | __GFP_FS);
267261
else if (pflags & PF_MEMALLOC_NOFS)
268262
flags &= ~__GFP_FS;
269263

270-
if (pflags & PF_MEMALLOC_NOWARN)
271-
flags |= __GFP_NOWARN;
272-
273264
if (pflags & PF_MEMALLOC_PIN)
274265
flags &= ~__GFP_MOVABLE;
275266
}

0 commit comments

Comments
 (0)