Re: [PATCH v6 18/18] arm64/mm: Automatically fold contpte mappings

2024-06-25 Thread Kefeng Wang
On 2024/6/25 15:23, Baolin Wang wrote: On 2024/6/25 11:16, Kefeng Wang wrote: On 2024/6/24 23:56, Ryan Roberts wrote: + Baolin Wang and Yin Fengwei, who maybe able to help with this. Hi Kefeng, Thanks for the report! On 24/06/2024 15:30, Kefeng Wang wrote: Hi Ryan, A big

Re: [PATCH v6 18/18] arm64/mm: Automatically fold contpte mappings

2024-06-24 Thread Kefeng Wang
On 2024/6/24 23:56, Ryan Roberts wrote: + Baolin Wang and Yin Fengwei, who maybe able to help with this. Hi Kefeng, Thanks for the report! On 24/06/2024 15:30, Kefeng Wang wrote: Hi Ryan, A big regression on page-fault3("Separate file shared mapping page fault") testcase fr

Re: [PATCH v6 18/18] arm64/mm: Automatically fold contpte mappings

2024-06-24 Thread Kefeng Wang
Hi Ryan, A big regression on page-fault3("Separate file shared mapping page fault") testcase from will-it-scale on arm64, no issue on x86, ./page_fault3_processes -t 128 -s 5 1) large folio disabled on ext4: 92378735 2) large folio enabled on ext4 + CONTPTE enabled 16164943 3) large fol

Re: [PATCH v2 5/7] riscv: mm: accelerate pagefault when badaccess

2024-04-10 Thread Kefeng Wang
On 2024/4/11 1:28, Alexandre Ghiti wrote: On 10/04/2024 10:07, Kefeng Wang wrote: On 2024/4/10 15:32, Alexandre Ghiti wrote: Hi Kefeng, On 03/04/2024 10:38, Kefeng Wang wrote: The access_error() of vma already checked under per-VMA lock, if it is a bad access, directly handle error, no

Re: [PATCH v2 5/7] riscv: mm: accelerate pagefault when badaccess

2024-04-10 Thread Kefeng Wang
On 2024/4/10 15:32, Alexandre Ghiti wrote: Hi Kefeng, On 03/04/2024 10:38, Kefeng Wang wrote: The access_error() of vma already checked under per-VMA lock, if it is a bad access, directly handle error, no need to retry with mmap_lock again. Since the page faut is handled under per-VMA lock

Re: [PATCH v2 0/7] arch/mm/fault: accelerate pagefault when badaccess

2024-04-07 Thread Kefeng Wang
On 2024/4/4 4:45, Andrew Morton wrote: On Wed, 3 Apr 2024 16:37:58 +0800 Kefeng Wang wrote: After VMA lock-based page fault handling enabled, if bad access met under per-vma lock, it will fallback to mmap_lock-based handling, so it leads to unnessary mmap lock and vma find again. A test

[PATCH v2 7/7] x86: mm: accelerate pagefault when badaccess

2024-04-03 Thread Kefeng Wang
page faut is handled under per-VMA lock, count it as a vma lock event with VMA_LOCK_SUCCESS. Reviewed-by: Suren Baghdasaryan Signed-off-by: Kefeng Wang --- arch/x86/mm/fault.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch

[PATCH v2 5/7] riscv: mm: accelerate pagefault when badaccess

2024-04-03 Thread Kefeng Wang
: Kefeng Wang --- arch/riscv/mm/fault.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 3ba1d4dde5dd..b3fcf7d67efb 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -292,7 +292,10 @@ void handle_page_fault

[PATCH v2 6/7] s390: mm: accelerate pagefault when badaccess

2024-04-03 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error, no need to retry with mmap_lock again. Since the page faut is handled under per-VMA lock, count it as a vma lock event with VMA_LOCK_SUCCESS. Signed-off-by: Kefeng Wang --- arch/s390/mm/fault.c

[PATCH v2 3/7] arm: mm: accelerate pagefault when VM_FAULT_BADACCESS

2024-04-03 Thread Kefeng Wang
: Suren Baghdasaryan Signed-off-by: Kefeng Wang --- arch/arm/mm/fault.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c index 439dc6a26bb9..5c4b417e24f9 100644 --- a/arch/arm/mm/fault.c +++ b/arch/arm/mm/fault.c @@ -294,7 +294,9

[PATCH v2 4/7] powerpc: mm: accelerate pagefault when badaccess

2024-04-03 Thread Kefeng Wang
mmap_lock. Since the page faut is handled under per-VMA lock, count it as a vma lock event with VMA_LOCK_SUCCESS. Signed-off-by: Kefeng Wang --- arch/powerpc/mm/fault.c | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch

[PATCH v2 0/7] arch/mm/fault: accelerate pagefault when badaccess

2024-04-03 Thread Kefeng Wang
-> 0.19198 Only build test on other archs except arm64. v2: - a better changelog, and describe the counting changes, suggested by Suren Baghdasaryan - add RB Kefeng Wang (7): arm64: mm: cleanup __do_page_fault() arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS arm: mm: acceler

[PATCH v2 2/7] arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS

2024-04-03 Thread Kefeng Wang
dled under per-VMA lock, count it as a vma lock event with VMA_LOCK_SUCCESS. Reviewed-by: Suren Baghdasaryan Signed-off-by: Kefeng Wang --- arch/arm64/mm/fault.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 9b

[PATCH v2 1/7] arm64: mm: cleanup __do_page_fault()

2024-04-03 Thread Kefeng Wang
The __do_page_fault() only calls handle_mm_fault() after vm_flags checked, and it is only called by do_page_fault(), let's squash it into do_page_fault() to cleanup code. Reviewed-by: Suren Baghdasaryan Signed-off-by: Kefeng Wang --- arch/arm64/mm/fault.c | 27 +++--

Re: [PATCH 7/7] x86: mm: accelerate pagefault when badaccess

2024-04-03 Thread Kefeng Wang
On 2024/4/3 13:59, Suren Baghdasaryan wrote: On Tue, Apr 2, 2024 at 12:53 AM Kefeng Wang wrote: The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error and return, there is no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off

Re: [PATCH 2/7] arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS

2024-04-02 Thread Kefeng Wang
On 2024/4/3 13:30, Suren Baghdasaryan wrote: On Tue, Apr 2, 2024 at 10:19 PM Suren Baghdasaryan wrote: On Tue, Apr 2, 2024 at 12:53 AM Kefeng Wang wrote: The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly set fault to VM_FAULT_BADACCESS and handle

[PATCH 7/7] x86: mm: accelerate pagefault when badaccess

2024-04-02 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error and return, there is no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off-by: Kefeng Wang --- arch/x86/mm/fault.c | 23 ++- 1 file changed, 14 insertions

[PATCH 1/7] arm64: mm: cleanup __do_page_fault()

2024-04-02 Thread Kefeng Wang
The __do_page_fault() only check vma->flags and call handle_mm_fault(), and only called by do_page_fault(), let's squash it into do_page_fault() to cleanup code. Signed-off-by: Kefeng Wang --- arch/arm64/mm/fault.c | 27 +++ 1 file changed, 7 insertions(+), 20 d

[PATCH 6/7] s390: mm: accelerate pagefault when badaccess

2024-04-02 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error and return, there is no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off-by: Kefeng Wang --- arch/s390/mm/fault.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH 0/7] arch/mm/fault: accelerate pagefault when badaccess

2024-04-02 Thread Kefeng Wang
-> 0.19198 Only build test on other archs except arm64. Kefeng Wang (7): arm64: mm: cleanup __do_page_fault() arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS arm: mm: accelerate pagefault when VM_FAULT_BADACCESS powerpc: mm: accelerate pagefault when badaccess riscv: mm: acceler

[PATCH 5/7] riscv: mm: accelerate pagefault when badaccess

2024-04-02 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error and return, there is no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off-by: Kefeng Wang --- arch/riscv/mm/fault.c | 5 - 1 file changed, 4 insertions(+), 1 deletion

[PATCH 4/7] powerpc: mm: accelerate pagefault when badaccess

2024-04-02 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly handle error and return, there is no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off-by: Kefeng Wang --- arch/powerpc/mm/fault.c | 33 - 1 file changed, 20

[PATCH 3/7] arm: mm: accelerate pagefault when VM_FAULT_BADACCESS

2024-04-02 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly set fault to VM_FAULT_BADACCESS and handle error, so no need to lock_mm_and_find_vma() and check vm_flags again. Signed-off-by: Kefeng Wang --- arch/arm/mm/fault.c | 4 +++- 1 file changed, 3 insertions

[PATCH 2/7] arm64: mm: accelerate pagefault when VM_FAULT_BADACCESS

2024-04-02 Thread Kefeng Wang
The vm_flags of vma already checked under per-VMA lock, if it is a bad access, directly set fault to VM_FAULT_BADACCESS and handle error, no need to lock_mm_and_find_vma() and check vm_flags again, the latency time reduce 34% in lmbench 'lat_sig -P 1 prot lat_sig'. Signed-off-by: K

Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()

2023-11-19 Thread Kefeng Wang
On 2023/11/20 14:40, Arnd Bergmann wrote: On Mon, Nov 20, 2023, at 01:39, Kefeng Wang wrote: On 2023/11/20 3:34, Geert Uytterhoeven wrote: On Sat, Nov 18, 2023 at 11:09 AM Kefeng Wang wrote: -/* - * Convert a physical pointer to a virtual kernel pointer for /dev/mem - * access

[PATCH v2] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()

2023-11-19 Thread Kefeng Wang
quot;David S. Miller" Cc: Stanislav Kinsburskii Reviewed-by: Geert Uytterhoeven [m68k] Acked-by: Geert Uytterhoeven [m68k] Reviewed-by: Geert Uytterhoeven [sh] Signed-off-by: Kefeng Wang --- v2: - remove mips change, since it needs more extra works for enable ar

Re: [PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()

2023-11-19 Thread Kefeng Wang
On 2023/11/20 3:34, Geert Uytterhoeven wrote: On Sat, Nov 18, 2023 at 11:09 AM Kefeng Wang wrote: The asm-generic/io.h already has default definition, remove unnecessary arch's defination. Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Russell King Cc: Brian Cain Cc: "

[PATCH] asm/io: remove unnecessary xlate_dev_mem_ptr() and unxlate_dev_mem_ptr()

2023-11-18 Thread Kefeng Wang
quot;David S. Miller" Cc: Stanislav Kinsburskii Signed-off-by: Kefeng Wang --- arch/alpha/include/asm/io.h| 6 -- arch/arm/include/asm/io.h | 6 -- arch/hexagon/include/asm/io.h | 6 -- arch/m68k/include/asm/io_mm.h | 6 -- arch/mips/include/asm/io.h | 7 ---

Re: [PATCH rfc v2 04/10] s390: mm: use try_vma_locked_page_fault()

2023-08-25 Thread Kefeng Wang
On 2023/8/24 16:32, Heiko Carstens wrote: On Thu, Aug 24, 2023 at 10:16:33AM +0200, Alexander Gordeev wrote: On Mon, Aug 21, 2023 at 08:30:50PM +0800, Kefeng Wang wrote: Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang

Re: [PATCH rfc v2 01/10] mm: add a generic VMA lock-based page fault handler

2023-08-25 Thread Kefeng Wang
On 2023/8/24 15:12, Alexander Gordeev wrote: On Mon, Aug 21, 2023 at 08:30:47PM +0800, Kefeng Wang wrote: Hi Kefeng, The ARCH_SUPPORTS_PER_VMA_LOCK are enabled by more and more architectures, eg, x86, arm64, powerpc and s390, and riscv, those implementation are very similar which results

Re: [PATCH rfc v2 05/10] powerpc: mm: use try_vma_locked_page_fault()

2023-08-22 Thread Kefeng Wang
On 2023/8/22 17:38, Christophe Leroy wrote: Le 21/08/2023 à 14:30, Kefeng Wang a écrit : Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Does it really simplifies code ? It's 32 insertions versus 34 deletions so only removing 2 lines. Y

[PATCH rfc v2 02/10] arm64: mm: use try_vma_locked_page_fault()

2023-08-21 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code, also pass struct vmf to __do_page_fault() directly instead of each independent variable. No functional change intended. Signed-off-by: Kefeng Wang --- arch/arm64/mm/fault.c | 60 --- 1 file

[PATCH rfc v2 04/10] s390: mm: use try_vma_locked_page_fault()

2023-08-21 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/s390/mm/fault.c | 66 ++-- 1 file changed, 27 insertions(+), 39 deletions(-) diff --git a/arch/s390/mm/fault.c b/arch/s390/mm

[PATCH rfc v2 03/10] x86: mm: use try_vma_locked_page_fault()

2023-08-21 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/x86/mm/fault.c | 55 +++-- 1 file changed, 23 insertions(+), 32 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm

[PATCH rfc v2 07/10] ARM: mm: try VMA lock-based page fault handling first

2023-08-21 Thread Kefeng Wang
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails. Signed-off-by: Kefeng Wang --- arch/arm/Kconfig| 1 + arch/arm/mm/fault.c | 35 +-- 2 files changed, 26 insertions(+), 10 deletions

[PATCH rfc v2 08/10] loongarch: mm: cleanup __do_page_fault()

2023-08-21 Thread Kefeng Wang
Cleanup __do_page_fault() by reuse bad_area_nosemaphore and bad_area label. Signed-off-by: Kefeng Wang --- arch/loongarch/mm/fault.c | 48 +-- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm

[PATCH rfc v2 09/10] loongarch: mm: add access_error() helper

2023-08-21 Thread Kefeng Wang
Add access_error() to check whether vma could be accessible or not, which will be used __do_page_fault() and later vma locked based page fault. Signed-off-by: Kefeng Wang --- arch/loongarch/mm/fault.c | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff

[PATCH rfc -next v2 00/10] mm: convert to generic VMA lock-based page fault

2023-08-21 Thread Kefeng Wang
scv/loongarch) headfile. - re-use struct vm_fault instead of adding new struct vm_locked_fault, per Matthew Wilcox, add necessary pt_regs/fault error code/vm flags into vm_fault since they could be used in arch_vma_access_error() - add special VM_FAULT_NONE and make try_vma_locked_page_fault()

[PATCH rfc v2 05/10] powerpc: mm: use try_vma_locked_page_fault()

2023-08-21 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/powerpc/mm/fault.c | 66 - 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch

[PATCH rfc v2 06/10] riscv: mm: use try_vma_locked_page_fault()

2023-08-21 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/riscv/mm/fault.c | 58 ++- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv

[PATCH rfc v2 01/10] mm: add a generic VMA lock-based page fault handler

2023-08-21 Thread Kefeng Wang
e could re-use struct vm_fault to record and check vma accessable by each own implementation. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 17 + include/linux/mm_types.h | 2 ++ mm/memory.c | 39 +++ 3 files c

[PATCH rfc v2 10/10] loongarch: mm: try VMA lock-based page fault handling first

2023-08-21 Thread Kefeng Wang
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails. Signed-off-by: Kefeng Wang --- arch/loongarch/Kconfig| 1 + arch/loongarch/mm/fault.c | 37 +++-- 2 files changed, 32 insertions(+), 6

Re: [PATCH rfc -next 01/10] mm: add a generic VMA lock-based page fault handler

2023-07-14 Thread Kefeng Wang
On 2023/7/14 9:52, Kefeng Wang wrote: On 2023/7/14 4:12, Suren Baghdasaryan wrote: On Thu, Jul 13, 2023 at 9:15 AM Matthew Wilcox wrote: +int try_vma_locked_page_fault(struct vm_locked_fault *vmlf, vm_fault_t *ret) +{ + struct vm_area_struct *vma; + vm_fault_t fault; On Thu

Re: [PATCH rfc -next 01/10] mm: add a generic VMA lock-based page fault handler

2023-07-13 Thread Kefeng Wang
On 2023/7/14 4:12, Suren Baghdasaryan wrote: On Thu, Jul 13, 2023 at 9:15 AM Matthew Wilcox wrote: +int try_vma_locked_page_fault(struct vm_locked_fault *vmlf, vm_fault_t *ret) +{ + struct vm_area_struct *vma; + vm_fault_t fault; On Thu, Jul 13, 2023 at 05:53:29PM +0800, Kefeng

Re: [PATCH rfc -next 00/10] mm: convert to generic VMA lock-based page fault

2023-07-13 Thread Kefeng Wang
Please ignore this one... On 2023/7/13 17:51, Kefeng Wang wrote: Add a generic VMA lock-based page fault handler in mm core, and convert architectures to use it, which eliminate architectures's duplicated codes. With it, we can avoid multiple changes in architectures's code if

[PATCH rfc -next 07/10] ARM: mm: try VMA lock-based page fault handling first

2023-07-13 Thread Kefeng Wang
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails. Signed-off-by: Kefeng Wang --- arch/arm/Kconfig| 1 + arch/arm/mm/fault.c | 15 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/arm

[PATCH rfc -next 04/10] s390: mm: use try_vma_locked_page_fault()

2023-07-13 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/s390/mm/fault.c | 23 ++- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index

[PATCH rfc -next 03/10] arm64: mm: use try_vma_locked_page_fault()

2023-07-13 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/arm64/mm/fault.c | 28 +--- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index

[PATCH rfc -next 01/10] mm: add a generic VMA lock-based page fault handler

2023-07-13 Thread Kefeng Wang
easy to support this feature on new architectures. Signed-off-by: Kefeng Wang --- include/linux/mm.h | 28 mm/memory.c| 42 ++ 2 files changed, 70 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h

[PATCH rfc -next 00/10] mm: convert to generic VMA lock-based page fault

2023-07-13 Thread Kefeng Wang
out commit 38b3aec8e8d2 "mm: drop per-VMA lock when returning VM_FAULT_RETRY or VM_FAULT_COMPLETED", and in the end, we enable this feature on ARM32/Loongarch too. This is based on next-20230713, only built test(no loongarch compiler, so except loongarch). Kefeng Wang (10): mm: add a generic

[PATCH rfc -next 10/10] loongarch: mm: try VMA lock-based page fault handling first

2023-07-13 Thread Kefeng Wang
Attempt VMA lock-based page fault handling first, and fall back to the existing mmap_lock-based handling if that fails. Signed-off-by: Kefeng Wang --- arch/loongarch/Kconfig| 1 + arch/loongarch/mm/fault.c | 26 ++ 2 files changed, 27 insertions(+) diff --git a

[PATCH rfc -next 09/10] loongarch: mm: add access_error() helper

2023-07-13 Thread Kefeng Wang
Add access_error() to check whether vma could be accessible or not, which will be used __do_page_fault() and later vma locked based page fault. Signed-off-by: Kefeng Wang --- arch/loongarch/mm/fault.c | 30 -- 1 file changed, 20 insertions(+), 10 deletions(-) diff

[PATCH rfc -next 08/10] loongarch: mm: cleanup __do_page_fault()

2023-07-13 Thread Kefeng Wang
Cleanup __do_page_fault() by reuse bad_area_nosemaphore and bad_area label. Signed-off-by: Kefeng Wang --- arch/loongarch/mm/fault.c | 36 +++- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/arch/loongarch/mm/fault.c b/arch/loongarch/mm/fault.c

[PATCH rfc -next 05/10] powerpc: mm: use try_vma_locked_page_fault()

2023-07-13 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/powerpc/mm/fault.c | 54 + 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch

[PATCH rfc -next 06/10] riscv: mm: use try_vma_locked_page_fault()

2023-07-13 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/riscv/mm/fault.c | 38 +++--- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm

[PATCH rfc -next 02/10] x86: mm: use try_vma_locked_page_fault()

2023-07-13 Thread Kefeng Wang
Use new try_vma_locked_page_fault() helper to simplify code. No functional change intended. Signed-off-by: Kefeng Wang --- arch/x86/mm/fault.c | 39 +++ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c

[PATCH rfc -next 00/10] mm: convert to generic VMA lock-based page fault

2023-07-13 Thread Kefeng Wang
out commit 38b3aec8e8d2 "mm: drop per-VMA lock when returning VM_FAULT_RETRY or VM_FAULT_COMPLETED", and in the end, we enable this feature on ARM32/Loongarch too. This is based on next-20230713, only built test(no loongarch compiler, so except loongarch). Kefeng Wang (10): mm: add a generic

[PATCH v2 1/2] mm: remove arguments of show_mem()

2023-06-29 Thread Kefeng Wang
All callers of show_mem() pass 0 and NULL, so we can remove the two arguments by directly calling __show_mem(0, NULL, MAX_NR_ZONES - 1) in show_mem(). Signed-off-by: Kefeng Wang --- v2: update commit log arch/powerpc/xmon/xmon.c | 2 +- drivers/tty/sysrq.c | 2 +- drivers/tty/vt

[PATCH v2 2/2] mm: make show_free_areas() static

2023-06-29 Thread Kefeng Wang
All callers of show_free_areas() pass 0 and NULL, so we can directly use show_mem() instead of show_free_areas(0, NULL), which could make show_free_areas() a static function. Signed-off-by: Kefeng Wang --- v2: update commit log and fix a missing show_free_areas() conversion arch/sparc/kernel

Re: [PATCH 2/2] mm: make show_free_areas() static

2023-06-29 Thread Kefeng Wang
Thanks, On 2023/6/29 23:00, kernel test robot wrote: Hi Kefeng, kernel test robot noticed the following build errors: [auto build test ERROR on akpm-mm/mm-everything] url: https://github.com/intel-lab-lkp/linux/commits/Kefeng-Wang/mm-make-show_free_areas-static/20230629-182958 base

Re: [PATCH 1/2] mm: remove arguments of show_mem()

2023-06-29 Thread Kefeng Wang
On 2023/6/29 23:17, Matthew Wilcox wrote: On Thu, Jun 29, 2023 at 06:43:56PM +0800, Kefeng Wang wrote: Directly call __show_mem(0, NULL, MAX_NR_ZONES - 1) in show_mem() to remove the arguments of show_mem(). Do you mean, "All callers of show_mem() pass 0 and NULL, so we can remove th

[PATCH 1/2] mm: remove arguments of show_mem()

2023-06-29 Thread Kefeng Wang
Directly call __show_mem(0, NULL, MAX_NR_ZONES - 1) in show_mem() to remove the arguments of show_mem(). Signed-off-by: Kefeng Wang --- arch/powerpc/xmon/xmon.c | 2 +- drivers/tty/sysrq.c | 2 +- drivers/tty/vt/keyboard.c | 2 +- include/linux/mm.h| 4 ++-- init/initramfs.c

[PATCH 2/2] mm: make show_free_areas() static

2023-06-29 Thread Kefeng Wang
Directly use show_mem() instead of show_free_areas(0, NULL), then make show_free_areas() a static function. Signed-off-by: Kefeng Wang --- arch/sparc/kernel/setup_32.c | 2 +- include/linux/mm.h | 12 mm/internal.h| 6 ++ mm/nommu.c

Re: [PATCH v3 03/14] arm64: reword ARCH_FORCE_MAX_ORDER prompt and help text

2023-03-24 Thread Kefeng Wang
an Signed-off-by: Mike Rapoport (IBM) Reviewed-by: Kefeng Wang --- arch/arm64/Kconfig | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7324032af859..cc11cdcf5a00 100644 --- a/arch/arm64/Kconfig

Re: [PATCH v3 02/14] arm64: drop ranges in definition of ARCH_FORCE_MAX_ORDER

2023-03-24 Thread Kefeng Wang
cations of changing MAX_ORDER before actually amending it and ranges don't help here. Drop ranges in definition of ARCH_FORCE_MAX_ORDER and make its prompt visible only if EXPERT=y Acked-by: Kirill A. Shutemov Reviewed-by: Zi Yan Signed-off-by: Mike Rapoport (IBM) Reviewed-by: Kefeng Wang -

Re: [PATCH v3 05/14] ia64: don't allow users to override ARCH_FORCE_MAX_ORDER

2023-03-24 Thread Kefeng Wang
On 2023/3/25 14:08, Mike Rapoport wrote: From: "Mike Rapoport (IBM)" It is enough to keep default values for base and huge pages without letting users to override ARCH_FORCE_MAX_ORDER. Drop the prompt to make the option unvisible in *config. Acked-by: Kirill A. Shutemov Reviewed-by: Zi Ya

[PATCH] mm: remove kern_addr_valid() completely

2022-10-18 Thread Kefeng Wang
valid() completely. Signed-off-by: Kefeng Wang --- arch/alpha/include/asm/pgtable.h | 2 - arch/arc/include/asm/pgtable-bits-arcv2.h | 2 - arch/arm/include/asm/pgtable-nommu.h | 2 - arch/arm/include/asm/pgtable.h| 4 -- arch/arm64/include/asm/pgtable.h | 2 -

[PATCH v4 04/11] sections: Move is_kernel_inittext() into sections.h

2021-09-30 Thread Kefeng Wang
The is_kernel_inittext() and init_kernel_text() are with same functionality, let's just keep is_kernel_inittext() and move it into sections.h, then update all the callers. Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: x...@kernel.org Signed-off-by: Kefeng Wang --- arch/x86/k

[PATCH v4 10/11] microblaze: Use is_kernel_text() helper

2021-09-30 Thread Kefeng Wang
Use is_kernel_text() helper to simplify code. Cc: Michal Simek Signed-off-by: Kefeng Wang --- arch/microblaze/mm/pgtable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c index c1833b159d3b..9f73265aad4e 100644

[PATCH v4 07/11] mm: kasan: Use is_kernel() helper

2021-09-30 Thread Kefeng Wang
Directly use is_kernel() helper in kernel_or_module_addr(). Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Signed-off-by: Kefeng Wang --- mm/kasan/report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/report.c b/mm/kasan

[PATCH v4 01/11] kallsyms: Remove arch specific text and data check

2021-09-30 Thread Kefeng Wang
After commit 4ba66a976072 ("arch: remove blackfin port"), no need arch-specific text/data check. Cc: Arnd Bergmann Signed-off-by: Kefeng Wang --- include/asm-generic/sections.h | 16 include/linux/kallsyms.h | 3 +-- kernel/locking/lockdep.c | 3 --

[PATCH v4 05/11] x86: mm: Rename __is_kernel_text() to is_x86_32_kernel_text()

2021-09-30 Thread Kefeng Wang
ext() naming for x86 special check. Cc: Ingo Molnar Cc: Borislav Petkov Cc: x...@kernel.org Signed-off-by: Kefeng Wang --- arch/x86/mm/init_32.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index bd90b8fe81e4..52374

[PATCH v4 02/11] kallsyms: Fix address-checks for kernel related range

2021-09-30 Thread Kefeng Wang
: Steven Rostedt (VMware) Acked-by: Sergey Senozhatsky Signed-off-by: Kefeng Wang --- include/linux/kallsyms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 2a241e3f063f..b016c62f30a6 100644 --- a/include/linux

[PATCH v4 08/11] extable: Use is_kernel_text() helper

2021-09-30 Thread Kefeng Wang
The core_kernel_text() should check the gate area, as it is part of kernel text range, use is_kernel_text() in core_kernel_text(). Cc: Steven Rostedt Signed-off-by: Kefeng Wang --- kernel/extable.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/extable.c b/kernel

[PATCH v4 11/11] alpha: Use is_kernel_text() helper

2021-09-30 Thread Kefeng Wang
Use is_kernel_text() helper to simplify code. Cc: Richard Henderson Cc: Ivan Kokshaysky Cc: Matt Turner Signed-off-by: Kefeng Wang --- arch/alpha/kernel/traps.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index

[PATCH v4 09/11] powerpc/mm: Use core_kernel_text() helper

2021-09-30 Thread Kefeng Wang
Use core_kernel_text() helper to simplify code, also drop etext, _stext, _sinittext, _einittext declaration which already declared in section.h. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Kefeng Wang

[PATCH v4 06/11] sections: Provide internal __is_kernel() and __is_kernel_text() helper

2021-09-30 Thread Kefeng Wang
An internal __is_kernel() helper which only check the kernel address ranges, and an internal __is_kernel_text() helper which only check text section ranges. Signed-off-by: Kefeng Wang --- include/asm-generic/sections.h | 29 + include/linux/kallsyms.h | 4

[PATCH v4 03/11] sections: Move and rename core_kernel_data() to is_kernel_core_data()

2021-09-30 Thread Kefeng Wang
Move core_kernel_data() into sections.h and rename it to is_kernel_core_data(), also make it return bool value, then update all the callers. Cc: Arnd Bergmann Cc: Steven Rostedt Cc: Ingo Molnar Cc: "David S. Miller" Signed-off-by: Kefeng Wang --- include/asm-generic/secti

[PATCH v4 00/11] sections: Unify kernel sections range check and use

2021-09-30 Thread Kefeng Wang
feng.w...@huawei.com Kefeng Wang (11): kallsyms: Remove arch specific text and data check kallsyms: Fix address-checks for kernel related range sections: Move and rename core_kernel_data() to is_kernel_core_data() sections: Move is_kernel_inittext() into sections.h x86: mm: Rename _

Re: [PATCH v3 9/9] powerpc/mm: Use is_kernel_text() and is_kernel_inittext() helper

2021-09-28 Thread Kefeng Wang
On 2021/9/29 1:51, Christophe Leroy wrote: Le 26/09/2021 à 09:20, Kefeng Wang a écrit : Use is_kernel_text() and is_kernel_inittext() helper to simplify code, also drop etext, _stext, _sinittext, _einittext declaration which already declared in section.h. Cc: Michael Ellerman Cc

[PATCH v3 4/9] sections: Move is_kernel_inittext() into sections.h

2021-09-26 Thread Kefeng Wang
The is_kernel_inittext() and init_kernel_text() are with same functionality, let's just keep is_kernel_inittext() and move it into sections.h, then update all the callers. Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: x...@kernel.org Signed-off-by: Kefeng Wang --- arch/x86/k

[PATCH v3 3/9] sections: Move and rename core_kernel_data() to is_kernel_core_data()

2021-09-26 Thread Kefeng Wang
Move core_kernel_data() into sections.h and rename it to is_kernel_core_data(), also make it return bool value, then update all the callers. Cc: Arnd Bergmann Cc: Steven Rostedt Cc: Ingo Molnar Cc: "David S. Miller" Signed-off-by: Kefeng Wang --- include/asm-generic/secti

[PATCH v3 6/9] sections: Provide internal __is_kernel() and __is_kernel_text() helper

2021-09-26 Thread Kefeng Wang
An internal __is_kernel() helper which only check the kernel address ranges, and an internal __is_kernel_text() helper which only check text section ranges. Signed-off-by: Kefeng Wang --- include/asm-generic/sections.h | 29 + include/linux/kallsyms.h | 4

[PATCH v3 9/9] powerpc/mm: Use is_kernel_text() and is_kernel_inittext() helper

2021-09-26 Thread Kefeng Wang
Use is_kernel_text() and is_kernel_inittext() helper to simplify code, also drop etext, _stext, _sinittext, _einittext declaration which already declared in section.h. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Kefeng

[PATCH v3 8/9] extable: Use is_kernel_text() helper

2021-09-26 Thread Kefeng Wang
The core_kernel_text() should check the gate area, as it is part of kernel text range. Cc: Steven Rostedt Signed-off-by: Kefeng Wang --- kernel/extable.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/extable.c b/kernel/extable.c index 98ca627ac5ef..0ba383d850ff

[PATCH v3 7/9] mm: kasan: Use is_kernel() helper

2021-09-26 Thread Kefeng Wang
Directly use is_kernel() helper in kernel_or_module_addr(). Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Signed-off-by: Kefeng Wang --- mm/kasan/report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/report.c b/mm/kasan

[PATCH v3 0/9] sections: Unify kernel sections range check and use

2021-09-26 Thread Kefeng Wang
ernel.org/linux-arch/20210626073439.150586-1-wangkefeng.w...@huawei.com Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-a...@vger.kernel.org Cc: b...@vger.kernel.org Kefeng Wang (9): kallsyms: Remove arch specific text and data check kallsyms: Fix address-checks for kernel related range secti

[PATCH v3 2/9] kallsyms: Fix address-checks for kernel related range

2021-09-26 Thread Kefeng Wang
: Steven Rostedt (VMware) Acked-by: Sergey Senozhatsky Signed-off-by: Kefeng Wang --- include/linux/kallsyms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index 2a241e3f063f..b016c62f30a6 100644 --- a/include/linux

[PATCH v3 1/9] kallsyms: Remove arch specific text and data check

2021-09-26 Thread Kefeng Wang
After commit 4ba66a976072 ("arch: remove blackfin port"), no need arch-specific text/data check. Cc: Arnd Bergmann Signed-off-by: Kefeng Wang --- include/asm-generic/sections.h | 16 include/linux/kallsyms.h | 3 +-- kernel/locking/lockdep.c | 3 --

[PATCH v3 5/9] x86: mm: Rename __is_kernel_text() to is_x86_32_kernel_text()

2021-09-26 Thread Kefeng Wang
ext() naming for x86 special check. Cc: Ingo Molnar Cc: Borislav Petkov Cc: x...@kernel.org Signed-off-by: Kefeng Wang --- arch/x86/mm/init_32.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index bd90b8fe81e4..52374

[PATCH -next] trap: Cleanup trap_init()

2021-08-12 Thread Kefeng Wang
: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Paul Walmsley Cc: Jeff Dike Cc: Richard Weinberger Cc: Anton Ivanov Cc: Andrew Morton Signed-off-by: Kefeng Wang --- arch/arc/kernel/traps.c | 5 - arch/arm/kernel/traps.c | 5 - arch/h8300/kernel/traps.c

Re: [PATCH v2 5/7] kallsyms: Rename is_kernel() and is_kernel_text()

2021-07-29 Thread Kefeng Wang
On 2021/7/29 12:05, Steven Rostedt wrote: On Thu, 29 Jul 2021 10:00:51 +0800 Kefeng Wang wrote: On 2021/7/28 23:28, Steven Rostedt wrote: On Wed, 28 Jul 2021 16:13:18 +0800 Kefeng Wang wrote: The is_kernel[_text]() function check the address whether or not in kernel[_text] ranges

Re: [PATCH v2 2/7] kallsyms: Fix address-checks for kernel related range

2021-07-28 Thread Kefeng Wang
On 2021/7/28 22:46, Steven Rostedt wrote: On Wed, 28 Jul 2021 16:13:15 +0800 Kefeng Wang wrote: The is_kernel_inittext/is_kernel_text/is_kernel function should not include the end address(the labels _einittext, _etext and _end) when check the address range, the issue exists since Linux

Re: [PATCH v2 6/7] sections: Add new is_kernel() and is_kernel_text()

2021-07-28 Thread Kefeng Wang
On 2021/7/28 23:32, Steven Rostedt wrote: On Wed, 28 Jul 2021 16:13:19 +0800 Kefeng Wang wrote: @@ -64,8 +64,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr) int notrace core_kernel_text(unsigned long addr) { - if (addr >= (unsigned l

Re: [PATCH v2 5/7] kallsyms: Rename is_kernel() and is_kernel_text()

2021-07-28 Thread Kefeng Wang
On 2021/7/28 23:28, Steven Rostedt wrote: On Wed, 28 Jul 2021 16:13:18 +0800 Kefeng Wang wrote: The is_kernel[_text]() function check the address whether or not in kernel[_text] ranges, also they will check the address whether or not in gate area, so use better name. Do you know what a

[PATCH v2 6/7] sections: Add new is_kernel() and is_kernel_text()

2021-07-28 Thread Kefeng Wang
The new is_kernel() check the kernel address ranges, and the new is_kernel_text() check the kernel text section ranges. Then use them to make some code clear. Cc: Arnd Bergmann Cc: Andrey Ryabinin Signed-off-by: Kefeng Wang --- include/asm-generic/sections.h | 27

[PATCH v2 3/7] sections: Move and rename core_kernel_data() to is_kernel_core_data()

2021-07-28 Thread Kefeng Wang
Move core_kernel_data() into sections.h and rename it to is_kernel_core_data(), also make it return bool value, then update all the callers. Cc: Arnd Bergmann Cc: Steven Rostedt Cc: Ingo Molnar Cc: "David S. Miller" Signed-off-by: Kefeng Wang --- include/asm-generic/secti

[PATCH v2 7/7] powerpc/mm: Use is_kernel_text() and is_kernel_inittext() helper

2021-07-28 Thread Kefeng Wang
Use is_kernel_text() and is_kernel_inittext() helper to simplify code, also drop etext, _stext, _sinittext, _einittext declaration which already declared in section.h. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Kefeng

[PATCH v2 4/7] sections: Move is_kernel_inittext() into sections.h

2021-07-28 Thread Kefeng Wang
The is_kernel_inittext() and init_kernel_text() are with same functionality, let's just keep is_kernel_inittext() and move it into sections.h, then update all the callers. Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: x...@kernel.org Signed-off-by: Kefeng Wang --- arch/x86/k

[PATCH v2 5/7] kallsyms: Rename is_kernel() and is_kernel_text()

2021-07-28 Thread Kefeng Wang
...@vger.kernel.org Signed-off-by: Kefeng Wang --- arch/x86/net/bpf_jit_comp.c | 2 +- include/linux/kallsyms.h| 8 kernel/cfi.c| 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 333650b9372a

  1   2   >