incoming
Subsystems (14)
Andrew Morton
maintainer16 patches, based on 7d42e98182586f57f376406d033f05fe135edb75.
Subsystems affected by this patch series:
mm/memory-failure
mm/kasan
mm/damon
xtensa
mm/shmem
ocfs2
scripts
mm/tools
lib
mm/pagecache
mm/debug
sh
mm/kasan
mm/memory-failure
mm/pagemap
Subsystem: mm/memory-failure
Naoya Horiguchi <[email protected]>:
mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable()
Subsystem: mm/kasan
Marco Elver <[email protected]>:
kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS
Subsystem: mm/damon
Adam Borowski <[email protected]>:
mm/damon: don't use strnlen() with known-bogus source length
Subsystem: xtensa
Guenter Roeck <[email protected]>:
xtensa: increase size of gcc stack frame check
Subsystem: mm/shmem
Liu Yuntao <[email protected]>:
mm/shmem.c: fix judgment error in shmem_is_huge()
Subsystem: ocfs2
Wengang Wang <[email protected]>:
ocfs2: drop acl cache for directories too
Subsystem: scripts
Miles Chen <[email protected]>:
scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error
Subsystem: mm/tools
Changbin Du <[email protected]>:
tools/vm/page-types: remove dependency on opt_file for idle page tracking
Subsystem: lib
Paul Menzel <[email protected]>:
lib/zlib_inflate/inffast: check config in C to avoid unused function warning
Subsystem: mm/pagecache
Minchan Kim <[email protected]>:
mm: fs: invalidate bh_lrus for only cold path
Subsystem: mm/debug
Weizhao Ouyang <[email protected]>:
mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN mm/debug: sync up latest migrate_reason to migrate_reason_names
Subsystem: sh
Geert Uytterhoeven <[email protected]>:
sh: pgtable-3level: fix cast to pointer from integer of different size
Subsystem: mm/kasan
Nathan Chancellor <[email protected]>:
kasan: always respect CONFIG_KASAN_STACK
Subsystem: mm/memory-failure
Qi Zheng <[email protected]>:
mm/memory_failure: fix the missing pte_unmap() call
Subsystem: mm/pagemap
Chen Jun <[email protected]>:
mm: fix uninitialized use in overcommit_policy_handler
arch/sh/include/asm/pgtable-3level.h | 2 +- fs/buffer.c | 8 ++++++-- fs/ocfs2/dlmglue.c | 3 ++- include/linux/buffer_head.h | 4 ++-- include/linux/migrate.h | 6 +++++- lib/Kconfig.debug | 2 +- lib/Kconfig.kasan | 2 ++ lib/zlib_inflate/inffast.c | 13 ++++++------- mm/damon/dbgfs-test.h | 16 ++++++++-------- mm/debug.c | 4 +++- mm/memory-failure.c | 12 ++++++------ mm/shmem.c | 4 ++-- mm/swap.c | 19 ++++++++++++++++--- mm/util.c | 4 ++-- scripts/Makefile.kasan | 3 ++- scripts/sorttable.c | 4 ++++ tools/vm/page-types.c | 2 +- 17 files changed, 69 insertions(+), 39 deletions(-)
Andrew Morton
maintainerPATCH 1/16 mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable()
From: Naoya Horiguchi <[email protected]>
Subject: mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable()
commit fcc00621d88b ("mm/hwpoison: retry with shake_page() for unhandlable pages") changes the return value of __get_hwpoison_page() to retry for transiently unhandlable cases. However, __get_hwpoison_page() currently fails to properly judge buddy pages as handlable, so hard/soft offline for buddy pages always fail as "unhandlable page". This is totally regrettable.
So let's add is_free_buddy_page() in HWPoisonHandlable(), so that __get_hwpoison_page() returns different return values between buddy pages and unhandlable pages as intended.
---
mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-failure.c renamed from mm/memory-failure.c~mm-hwpoison-add-is_free_buddy_page-in-hwpoisonhandlable +1 -1
@@ -1126,7 +1126,7 @@ static int page_action(struct page_state*/ static inline bool HWPoisonHandlable (struct page *page) { -return PageLRU (page) ||__PageMovable (page); +return PageLRU (page) ||__PageMovable (page) ||is_free_buddy_page (page); }static int __get_hwpoison_page (struct page *page)
_
Andrew Morton
maintainerPATCH 2/16 kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS
In reply to Andrew MortonFrom: Marco Elver <[email protected]>
Subject: kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS
In the main KASAN config option CC_HAS_WORKING_NOSANITIZE_ADDRESS is checked for instrumentation-based modes. However, if HAVE_ARCH_KASAN_HW_TAGS is true all modes may still be selected.
To fix, also make the software modes depend onCC_HAS_WORKING_NOSANITIZE_ADDRESS.
---
lib/Kconfig.kasan | 2 ++ 1 file changed, 2 insertions(+)
lib/Kconfig.kasan renamed from lib/Kconfig.kasan~kasan-fix-kconfig-check-of-cc_has_working_nosanitize_address +2 -0
@@ -66,6 +66,7 @@ choice config KASAN_GENERIC bool "Generic mode" depends on HAVE_ARCH_KASAN && CC_HAS_KASAN_GENERIC + depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS select SLUB_DEBUG if SLUB select CONSTRUCTORS help
@@ -86,6 +87,7 @@ config KASAN_GENERIC config KASAN_SW_TAGS bool "Software tag-based mode" depends on HAVE_ARCH_KASAN_SW_TAGS && CC_HAS_KASAN_SW_TAGS + depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS select SLUB_DEBUG if SLUB select CONSTRUCTORS help
_
Andrew Morton
maintainerPATCH 3/16 mm/damon: don't use strnlen() with known-bogus source length
In reply to Andrew MortonFrom: Adam Borowski <[email protected]>
Subject: mm/damon: don't use strnlen() with known-bogus source length
gcc knows the true length too, and rightfully complains.
---
mm/damon/dbgfs-test.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
mm/damon/dbgfs-test.h renamed from mm/damon/dbgfs-test.h~mm-damon-dont-use-strnlen-with-known-bogus-source-length +8 -8
@@ -20,27 +20,27 @@ static void damon_dbgfs_test_str_to_targssize_t nr_integers =0 , i; question ="123" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )1 , nr_integers);KUNIT_EXPECT_EQ (test,123ul , answers[0 ]);kfree (answers); question ="123abc" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )1 , nr_integers);KUNIT_EXPECT_EQ (test,123ul , answers[0 ]);kfree (answers); question ="a123" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )0 , nr_integers);kfree (answers); question ="12 35" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )2 , nr_integers);for (i =0 ; i < nr_integers; i++)
@@ -48,7 +48,7 @@ static void damon_dbgfs_test_str_to_targkfree (answers); question ="12 35 46" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )3 , nr_integers);for (i =0 ; i < nr_integers; i++)
@@ -56,7 +56,7 @@ static void damon_dbgfs_test_str_to_targkfree (answers); question ="12 35 abc 46" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )2 , nr_integers);for (i =0 ; i <2 ; i++)
@@ -64,13 +64,13 @@ static void damon_dbgfs_test_str_to_targkfree (answers); question ="" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )0 , nr_integers);kfree (answers); question ="\n" ; - answers =str_to_target_ids (question,strnlen (question,128 ), + answers =str_to_target_ids (question,strlen (question), &nr_integers);KUNIT_EXPECT_EQ (test, (ssize_t )0 , nr_integers);kfree (answers);
_
Andrew Morton
maintainerPATCH 4/16 xtensa: increase size of gcc stack frame check
In reply to Andrew MortonFrom: Guenter Roeck <[email protected]>
Subject: xtensa: increase size of gcc stack frame check
xtensa frame size is larger than the frame size for almost all other architectures. This results in more than 50 "the frame size of <n> is larger than 1024 bytes" errors when trying to build xtensa:allmodconfig.
Increase frame size for xtensa to 1536 bytes to avoid compile errors due to frame size limits.
---
lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/Kconfig.debug renamed from lib/Kconfig.debug~xtensa-increase-size-of-gcc-stack-frame-check +1 -1
@@ -346,7 +346,7 @@ config FRAME_WARN int "Warn for stack frames larger than" range 0 8192 default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1536 if (!64BIT && PARISC) + default 1536 if (!64BIT && (PARISC || XTENSA)) default 1024 if (!64BIT && !PARISC) default 2048 if 64BIT help
_
Andrew Morton
maintainerPATCH 5/16 mm/shmem.c: fix judgment error in shmem_is_huge()
In reply to Andrew MortonFrom: Liu Yuntao <[email protected]>
Subject: mm/shmem.c: fix judgment error in shmem_is_huge()
In the case of SHMEM_HUGE_WITHIN_SIZE, the page index is not rounded up correctly. When the page index points to the first page in a huge page, round_up() cannot bring it to the end of the huge page, but to the end of the previous one.
An example:
HPAGE_PMD_NR on my machine is 512(2 MB huge page size). After allcoating a 3000 KB buffer, I access it at location 2050 KB. In shmem_is_huge(), the corresponding index happens to be 512. After rounded up by HPAGE_PMD_NR, it will still be 512 which is smaller than i_size, and shmem_is_huge() will return true. As a result, my buffer takes an additional huge page, and that shouldn't happen when shmem_enabled is set to within_size.
---
mm/shmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/shmem.c renamed from mm/shmem.c~fix-judgment-error-in-shmem_is_huge +2 -2
@@ -490,9 +490,9 @@ bool shmem_is_huge(struct vm_area_structcase SHMEM_HUGE_ALWAYS :return true;case SHMEM_HUGE_WITHIN_SIZE : - index =round_up (index,HPAGE_PMD_NR ); + index =round_up (index +1 ,HPAGE_PMD_NR ); i_size =round_up (i_size_read (inode),PAGE_SIZE ); -if (i_size >=HPAGE_PMD_SIZE && (i_size >>PAGE_SHIFT ) >= index) +if (i_size >>PAGE_SHIFT >= index)return true; fallthrough;case SHMEM_HUGE_ADVISE :
_
Andrew Morton
maintainerPATCH 6/16 ocfs2: drop acl cache for directories too
In reply to Andrew MortonFrom: Wengang Wang <[email protected]>
Subject: ocfs2: drop acl cache for directories too
ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale.
The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case:
Node 1 Node 2
-------------- ----------------
getfacl dir1
getfacl dir1 <-- this is OK
setfacl -m u:user1:rwX dir1
getfacl dir1 <-- see the change for user1
getfacl dir1 <-- can't see change for user1
---
fs/ocfs2/dlmglue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ocfs2/dlmglue.c renamed from fs/ocfs2/dlmglue.c~ocfs2-drop-acl-cache-for-directories-too +2 -1
@@ -3951,7 +3951,7 @@ static int ocfs2_data_convert_worker(str oi =OCFS2_I (inode); oi->ip_dir_lock_gen++;mlog (0 ,"generation: %u\n" , oi->ip_dir_lock_gen); - goto out; + goto out_forget; }if (!S_ISREG (inode->i_mode))
@@ -3982,6 +3982,7 @@ static int ocfs2_data_convert_worker(strfilemap_fdatawait (mapping); } +out_forget:forget_all_cached_acls (inode); out:
_
Andrew Morton
maintainerPATCH 7/16 scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error
In reply to Andrew MortonFrom: Miles Chen <[email protected]>
Subject: scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error
Fix the following build break by adding a conditional definition of EM_RISCV in order to allow cross-compilation on machines which do not have EM_RISCV definition in their host.
build break log from [1]:scripts/sorttable.c:352:7: error: use of undeclared identifier 'EM_RISCV'
[1] https://lore.kernel.org/lkml/[email protected]/
EM_RISCV was added to <elf.h> in glibc 2.24 so builds on systems with glibc headers < 2.24 should show this error.
---
scripts/sorttable.c | 4 ++++ 1 file changed, 4 insertions(+)
scripts/sorttable.c renamed from scripts/sorttable.c~scripts-sorttable-riscv-fix-undelcred-identifier-em_riscv-error +4 -0
@@ -54,6 +54,10 @@#define EM_ARCV2 195#endif +#ifndef EM_RISCV +#define EM_RISCV 243 +#endif +static uint32_t (*r)(const uint32_t *);static uint16_t (*r2)(const uint16_t *);static uint64_t (*r8)(const uint64_t *);
_
Andrew Morton
maintainerPATCH 8/16 tools/vm/page-types: remove dependency on opt_file for idle page tracking
In reply to Andrew MortonFrom: Changbin Du <[email protected]>
Subject: tools/vm/page-types: remove dependency on opt_file for idle page tracking
Idle page tracking can also be used for process address space, not only file mappings.
Without this change, using with '-i' option for process address space encounters below errors reported.
$ sudo ./page-types -p $(pidof bash) -i mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor ....
---
tools/vm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/vm/page-types.c renamed from tools/vm/page-types.c~tools-vm-page-types-remove-dependency-on-opt_file-for-idle-page-tracking +1 -1
@@ -1331,7 +1331,7 @@ int main(int argc, char *argv[])if (opt_list && opt_list_mapcnt) kpagecount_fd =checked_open (PROC_KPAGECOUNT ,O_RDONLY ); -if (opt_mark_idle && opt_file) +if (opt_mark_idle) page_idle_fd =checked_open (SYS_KERNEL_MM_PAGE_IDLE ,O_RDWR );if (opt_list && opt_pid)
_
Andrew Morton
maintainerPATCH 9/16 lib/zlib_inflate/inffast: check config in C to avoid unused function warning
In reply to Andrew MortonFrom: Paul Menzel <[email protected]>
Subject: lib/zlib_inflate/inffast: check config in C to avoid unused function warning
Building Linux for ppc64le with Ubuntu clang version 12.0.0-3ubuntu1~21.04.1 shows the warning below.
arch/powerpc/boot/inffast.c:20:1: warning: unused function 'get_unaligned16' [-Wunused-function] get_unaligned16(const unsigned short *p)
^
1 warning generated.
Fix it, by moving the check from the preprocessor to C, so the compiler sees the use.
---
lib/zlib_inflate/inffast.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
lib/zlib_inflate/inffast.c renamed from lib/zlib_inflate/inffast.c~lib-zlib_inflate-inffast-check-config-in-c-to-avoid-unused-function-warning +6 -7
@@ -253,13 +253,12 @@ void inflate_fast(z_streamp strm, unsign sfrom = (unsigned short *)(from); loops = len >>1 ; - do -#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS - *sout++ = *sfrom++; -#else - *sout++ =get_unaligned16 (sfrom++); -#endif -while (--loops); +do { +if (IS_ENABLED (CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS )) + *sout++ = *sfrom++; +else + *sout++ =get_unaligned16 (sfrom++); + }while (--loops); out = (unsigned char *)sout; from = (unsigned char *)sfrom; }else {/* dist == 1 or dist == 2 */
_
Andrew Morton
maintainerPATCH 10/16 mm: fs: invalidate bh_lrus for only cold path
In reply to Andrew MortonFrom: Minchan Kim <[email protected]>
Subject: mm: fs: invalidate bh_lrus for only cold path
kernel test robot reported the regression of fio.write_iops[1] with [2].
Since lru_add_drain is called frequently, invalidate bh_lrus there could increase bh_lrus cache miss ratio, which needs more IO in the end.
This patch moves the bh_lrus invalidation from the hot path( e.g., zap_page_range, pagevec_release) to cold path(i.e., lru_add_drain_all, lru_cache_disable).
"Xing, Zhengjun" confirmed
: I test the patch, the regression reduced to -2.9%.
[1] https://lore.kernel.org/lkml/20210520083144.GD14190@xsang-OptiPlex-9020/
[2] 8cc621d2f45d, mm: fs: invalidate BH LRU during page migration
---
fs/buffer.c | 8 ++++++-- include/linux/buffer_head.h | 4 ++-- mm/swap.c | 19 ++++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-)
fs/buffer.c renamed from fs/buffer.c~mm-fs-invalidate-bh_lrus-for-only-cold-path +6 -2
@@ -1425,12 +1425,16 @@ void invalidate_bh_lrus(void) }EXPORT_SYMBOL_GPL (invalidate_bh_lrus); -void invalidate_bh_lrus_cpu (int cpu) +/* +* It's called from workqueue context so we need a bh_lru_lock to close +* the race with preemption/irq. +*/ +void invalidate_bh_lrus_cpu (void ) {struct bh_lru *b;bh_lru_lock (); - b =per_cpu_ptr (&bh_lrus, cpu); + b =this_cpu_ptr (&bh_lrus);__invalidate_bh_lrus (b);bh_lru_unlock (); }
include/linux/buffer_head.h renamed from include/linux/buffer_head.h~mm-fs-invalidate-bh_lrus-for-only-cold-path +2 -2
@@ -194,7 +194,7 @@ void __breadahead_gfp(struct block_devicstruct buffer_head *__bread_gfp (struct block_device *,sector_t block,unsigned size,gfp_t gfp);void invalidate_bh_lrus (void ); -void invalidate_bh_lrus_cpu (int cpu); +void invalidate_bh_lrus_cpu (void );bool has_bh_in_lru (int cpu,void *dummy);struct buffer_head *alloc_buffer_head (gfp_t gfp_flags);void free_buffer_head (struct buffer_head * bh);
@@ -408,7 +408,7 @@ static inline int inode_has_buffers(strustatic inline void invalidate_inode_buffers (struct inode *inode) {}static inline int remove_inode_buffers (struct inode *inode) {return 1 ; }static inline int sync_mapping_buffers (struct address_space *mapping) {return 0 ; } -static inline void invalidate_bh_lrus_cpu (int cpu) {} +static inline void invalidate_bh_lrus_cpu (void ) {}static inline bool has_bh_in_lru (int cpu,void *dummy) {return false; }#define buffer_heads_over_limit 0
mm/swap.c renamed from mm/swap.c~mm-fs-invalidate-bh_lrus-for-only-cold-path +16 -3
@@ -620,7 +620,6 @@ void lru_add_drain_cpu(int cpu)pagevec_lru_move_fn (pvec, lru_lazyfree_fn);activate_page_drain (cpu); -invalidate_bh_lrus_cpu (cpu); }/**
@@ -703,6 +702,20 @@ void lru_add_drain(void)local_unlock (&lru_pvecs.lock); } +/* +* It's called from per-cpu workqueue context in SMP case so +* lru_add_drain_cpu and invalidate_bh_lrus_cpu should run on +* the same cpu. It shouldn't be a problem in !SMP case since +* the core is only one and the locks will disable preemption. +*/ +static void lru_add_and_bh_lrus_drain (void ) +{ +local_lock (&lru_pvecs.lock); +lru_add_drain_cpu (smp_processor_id ()); +local_unlock (&lru_pvecs.lock); +invalidate_bh_lrus_cpu (); +} +void lru_add_drain_cpu_zone (struct zone *zone) {local_lock (&lru_pvecs.lock);
@@ -717,7 +730,7 @@ static DEFINE_PER_CPU(struct work_structstatic void lru_add_drain_per_cpu (struct work_struct *dummy) { -lru_add_drain (); +lru_add_and_bh_lrus_drain (); }/*
@@ -858,7 +871,7 @@ void lru_cache_disable(void)*/ __lru_add_drain_all (true);#else -lru_add_drain (); +lru_add_and_bh_lrus_drain ();#endif }
_
Andrew Morton
maintainerPATCH 11/16 mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN
In reply to Andrew MortonFrom: Weizhao Ouyang <[email protected]>
Subject: mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN
Sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN to migrate_reason_names.
---
mm/debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/debug.c renamed from mm/debug.c~mm-debug-sync-up-mr_contig_range-and-mr_longterm_pin +2 -1
@@ -24,7 +24,8 @@ const char *migrate_reason_names[MR_TYPE"syscall_or_cpuset" ,"mempolicy_mbind" ,"numa_misplaced" , - "cma", +"contig_range" , + "longterm_pin", }; const struct trace_print_flags pageflag_names[] = {
_
Andrew Morton
maintainerPATCH 12/16 mm/debug: sync up latest migrate_reason to migrate_reason_names
In reply to Andrew MortonFrom: Weizhao Ouyang <[email protected]>
Subject: mm/debug: sync up latest migrate_reason to migrate_reason_names
Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt.
---
include/linux/migrate.h | 6 +++++- mm/debug.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-)
include/linux/migrate.h renamed from include/linux/migrate.h~mm-debug-sync-up-latest-migrate_reason-to-migrate_reason_names +5 -1
@@ -19,6 +19,11 @@ struct migration_target_control;*/ #define MIGRATEPAGE_SUCCESS 0 +/* +* Keep sync with: +* - macro MIGRATE_REASON in include/trace/events/migrate.h +* - migrate_reason_names[MR_TYPES] in mm/debug.c +*/ enum migrate_reason {MR_COMPACTION ,MR_MEMORY_FAILURE ,
@@ -32,7 +37,6 @@ enum migrate_reason { MR_TYPES }; -/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */ extern const char *migrate_reason_names[MR_TYPES ];#ifdef CONFIG_MIGRATION
mm/debug.c renamed from mm/debug.c~mm-debug-sync-up-latest-migrate_reason-to-migrate_reason_names +1 -0
@@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPE"numa_misplaced" ,"contig_range" ,"longterm_pin" , + "demotion", }; const struct trace_print_flags pageflag_names[] = {
_
Andrew Morton
maintainerPATCH 13/16 sh: pgtable-3level: fix cast to pointer from integer of different size
In reply to Andrew MortonFrom: Geert Uytterhoeven <[email protected]>
Subject: sh: pgtable-3level: fix cast to pointer from integer of different size
If X2TLB=y (CPU_SHX2=y or CPU_SHX3=y, e.g. migor_defconfig), pgd_t.pgd is "unsigned long long", causing:
In file included from arch/sh/include/asm/pgtable.h:13,
from include/linux/pgtable.h:6,
from include/linux/mm.h:33,
from arch/sh/kernel/asm-offsets.c:14:
arch/sh/include/asm/pgtable-3level.h: In function `pud_pgtable':
arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
37 | return (pmd_t *)pud_val(pud);
| ^
Fix this by adding an intermediate cast to "unsigned long", which is basically what the old code did before.
---
arch/sh/include/asm/pgtable-3level.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/asm/pgtable-3level.h renamed from arch/sh/include/asm/pgtable-3level.h~sh-pgtable-3level-fix-cast-to-pointer-from-integer-of-different-size +1 -1
@@ -34,7 +34,7 @@ typedef struct { unsigned long long pmd;static inline pmd_t *pud_pgtable (pud_t pud) { -return (pmd_t *)pud_val (pud); +return (pmd_t *)(unsigned long )pud_val (pud); }/* only used by the stubbed out hugetlb gup code, should never be called */
_
Andrew Morton
maintainerPATCH 14/16 kasan: always respect CONFIG_KASAN_STACK
In reply to Andrew MortonFrom: Nathan Chancellor <[email protected]>
Subject: kasan: always respect CONFIG_KASAN_STACK
Currently, the asan-stack parameter is only passed along if CFLAGS_KASAN_SHADOW is not empty, which requires KASAN_SHADOW_OFFSET to be defined in Kconfig so that the value can be checked. In RISC-V's case, KASAN_SHADOW_OFFSET is not defined in Kconfig, which means that asan-stack does not get disabled with clang even when CONFIG_KASAN_STACK is disabled, resulting in large stack warnings with allmodconfig:
drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c:117:12:
error: stack frame size (14400) exceeds limit (2048) in function 'lb035q02_connect' [-Werror,-Wframe-larger-than]
static int lb035q02_connect(struct omap_dss_device *dssdev)
^
1 error generated.
Ensure that the value of CONFIG_KASAN_STACK is always passed along to the compiler so that these warnings do not happen when CONFIG_KASAN_STACK is disabled.
References: 6baec880d7a5 ("kasan: turn off asan-stack for clang-8 and earlier")
---
scripts/Makefile.kasan | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.kasan renamed from scripts/Makefile.kasan~kasan-always-respect-config_kasan_stack +2 -1
@@ -33,10 +33,11 @@ else CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ $(call cc-param,asan-globals=1) \ $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ - $(call cc-param,asan-stack=$(stack_enable)) \ $(call cc-param,asan-instrument-allocas=1) endif +CFLAGS_KASAN += $(call cc-param,asan-stack=$(stack_enable)) + endif # CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_SW_TAGS
_
Andrew Morton
maintainerPATCH 15/16 mm/memory_failure: fix the missing pte_unmap() call
In reply to Andrew MortonFrom: Qi Zheng <[email protected]>
Subject: mm/memory_failure: fix the missing pte_unmap() call
The paired pte_unmap() call is missing before thedev_pagemap_mapping_shift() returns. So fix it.
Davidsaid "I guess this code never runs on 32bit / highmem, that's why we didn't notice so far".
---
mm/memory-failure.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
mm/memory-failure.c renamed from mm/memory-failure.c~mm-memory_failure-fix-the-missing-pte_unmap-call +5 -5
@@ -306,6 +306,7 @@ static unsigned long dev_pagemap_mapping struct vm_area_struct *vma) {unsigned long address =vma_address (page, vma); +unsigned long ret =0 ;pgd_t *pgd;p4d_t *p4d;pud_t *pud;
@@ -329,11 +330,10 @@ static unsigned long dev_pagemap_mappingif (pmd_devmap (*pmd))return PMD_SHIFT ; pte =pte_offset_map (pmd, address); -if (!pte_present (*pte)) -return 0 ; -if (pte_devmap (*pte)) -return PAGE_SHIFT ; -return 0 ; +if (pte_present (*pte) &&pte_devmap (*pte)) + ret =PAGE_SHIFT ; +pte_unmap (pte); +return ret; }/*
_
Andrew Morton
maintainerPATCH 16/16 mm: fix uninitialized use in overcommit_policy_handler
In reply to Andrew MortonFrom: Chen Jun <[email protected]>
Subject: mm: fix uninitialized use in overcommit_policy_handler
We get an unexpected value of /proc/sys/vm/overcommit_memory after running the following program:
int main()
{
int fd = open("/proc/sys/vm/overcommit_memory", O_RDWR);
write(fd, "1", 1);
write(fd, "2", 1);
close(fd);
}write(fd, "2", 1) will pass *ppos = 1 to proc_dointvec_minmax. proc_dointvec_minmax will return 0 without setting new_policy.
t.data = &new_policy;
ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos)
-->do_proc_dointvec
-->__do_proc_dointvec
if (write) {
if (proc_first_pos_non_zero_ignore(ppos, table))
goto out;sysctl_overcommit_memory = new_policy;
so sysctl_overcommit_memory will be set to an uninitialized value.
Check whether new_policy has been changed by proc_dointvec_minmax.
---
mm/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/util.c renamed from mm/util.c~mm-fix-the-uninitialized-use-in-overcommit_policy_handler +2 -2
@@ -787,7 +787,7 @@ int overcommit_policy_handler(struct ctl size_t *lenp, loff_t *ppos) { struct ctl_table t; -int new_policy; +int new_policy =-1 ;int ret;/*
@@ -805,7 +805,7 @@ int overcommit_policy_handler(struct ctl t = *table; t.data = &new_policy; ret =proc_dointvec_minmax (&t, write, buffer, lenp, ppos); -if (ret) +if (ret || new_policy ==-1 )return ret;mm_compute_batch (new_policy);
_