sirlucjan / kernel-patches

Custom Linux kernel patches

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[5.17] UKSM-SPF + SPF result in a non-booting Kernel

ms178 opened this issue · comments

commented

Hello @sirlucjan,

thanks for the timely update. While trying out the new patches, I found a problem with UKSM-Speculative patches. Using this patchset together with the Speculative patchset result in a non-booting Kernel (the compilation went fiine though). Without the UKSM-Speculative patch, the Kernel boots fine.

I use a couple of other patches on top and the Xanmod sources as my baseline. But I could narrow the problem down to that particular patchset. I've attached my config and the PKGBUILD where you can find the additional patches I use, that config boots fine as long as you don't add the UKSM-Speculative patch. I hope this problem can be fixed.

myconfig.txt
PKGBUILD.txt
.

So is the speculative itself working properly? If so, I will remove uksm-speculative. This was just a "quick" porting attempt.

commented

Yes, the SPF patchset works properly on its own. Unfortunately more work seems to be needed to get it to work with UKSM though.

If this would not be a problem - could you check if speculative works properly with lru-speculative? I don't have the ability to do that at the moment, not until the end of the week. So far it's just a porting attempt. I have removed uksm-speculative for the time being.

Although I don't rule out the possibility that I made a mistake when porting UKSM. I'll have to see about that.

commented

It is a bit hard as I am using the Xanmod sources as a base and compile with Makepkg from AUR, the (normal?) LRU patchset is already included in the Xanmod sources and not easily revertable, currently I simply add some of your patches on top. And I can already report that the Xanmod sources work fine with the SPF patchset which is included there, so is a special LRU-SPF patchset needed?

If you used the xanmod sources and everything worked, then I don't see a problem. Thanks for the information. I will try to fix UKSM.

I need to study the problem more closely. I'll see if the regular UKSM works properly first.

@ms178 I've noticed that the mm/mmap.c file has changed a bit and added new values "mmap_write_lock(mm);" and "mmap_write_unlock(mm);" - maybe this was the reason why UKSM would not boot. I corrected it and I'm waiting for feedback - but to tell the truth I have a feeling that the time will come to abandon UKSM. It would also be helpful to have the error message that is there when booting.

commented

@sirlucjan I have good news and bad news. The good news, with the v2-version of the UKSM patches, the Kernel now boots. The bad news is that gaming performance regressed quite a bit:

Company of Heroes 2 (very old and CPU-limited): 92 fps -> 86 fps
Tomb Raider (the modern reboot, still quite old by now): 91 fps -> 88 fps

As the original problem is now fixed, I close this issue nonetheless. Thanks for your work!

You're welcome. Thanks a lot for the feedback. You don't even realize how helpful such bug reports are.

commented

@sirlucjan Just wanted to let you know that UKSM-speculative-v2 is not applying cleanly any longer.

Are you sure? Maybe you are using an additional patch?

  1. Speculative + UKSM
lucjan at archlinux ~ 13:46:58    
❯ patchmaker-trunk-v1
---> patching source with ../0001-speculative-patches.patch <---
patching file mm/debug.c
patching file include/linux/mmap_lock.h
patching file include/linux/mmap_lock.h
patching file mm/memory.c
Hunk #1 succeeded at 3821 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3748 (offset 22 lines).
Hunk #2 succeeded at 3778 (offset 22 lines).
patching file mm/Kconfig
patching file arch/x86/Kconfig
patching file include/linux/mm.h
patching file include/linux/mm_types.h
patching file include/linux/mm.h
patching file mm/memory.c
Hunk #1 succeeded at 4792 (offset 31 lines).
Hunk #2 succeeded at 4842 (offset 31 lines).
patching file include/linux/mm_types.h
patching file include/linux/mmap_lock.h
patching file include/linux/mm_types.h
patching file kernel/fork.c
patching file drivers/gpu/drm/i915/i915_gpu_error.c
patching file include/linux/mm.h
patching file mm/mmap.c
patching file arch/x86/mm/fault.c
patching file include/linux/mm_types.h
patching file include/linux/vm_event_item.h
patching file mm/vmstat.c
Hunk #1 succeeded at 1391 (offset 1 line).
patching file mm/memory.c
Hunk #1 succeeded at 2747 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3791 (offset 22 lines).
Hunk #2 succeeded at 4093 (offset 31 lines).
Hunk #3 succeeded at 4558 (offset 31 lines).
Hunk #4 succeeded at 4697 (offset 31 lines).
patching file include/linux/mm.h
patching file mm/memory.c
Hunk #1 succeeded at 4612 (offset 31 lines).
Hunk #2 succeeded at 4627 (offset 31 lines).
Hunk #3 succeeded at 4919 (offset 31 lines).
patching file include/linux/mm.h
patching file mm/memory.c
Hunk #1 succeeded at 2767 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3868 (offset 22 lines).
Hunk #2 succeeded at 3895 (offset 22 lines).
Hunk #3 succeeded at 3913 (offset 22 lines).
Hunk #4 succeeded at 3932 (offset 22 lines).
patching file arch/x86/mm/fault.c
patching file mm/memory.c
Hunk #1 succeeded at 4396 (offset 31 lines).
Hunk #2 succeeded at 4642 (offset 31 lines).
Hunk #3 succeeded at 4975 (offset 31 lines).
Hunk #4 succeeded at 4997 (offset 31 lines).
patching file mm/memory.c
Hunk #1 succeeded at 4472 (offset 31 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3611 (offset 22 lines).
Hunk #2 succeeded at 4647 (offset 31 lines).
patching file include/linux/percpu-rwsem.h
patching file kernel/locking/percpu-rwsem.c
patching file include/linux/mm_types.h
patching file include/linux/mmu_notifier.h
patching file kernel/fork.c
patching file mm/mmap.c
patching file include/linux/mmu_notifier.h
patching file mm/memory.c
Hunk #1 succeeded at 3109 (offset 22 lines).
Hunk #2 succeeded at 3146 (offset 22 lines).
Hunk #3 succeeded at 3164 (offset 22 lines).
Hunk #4 succeeded at 3243 (offset 22 lines).
Hunk #5 succeeded at 3261 (offset 22 lines).
Hunk #6 succeeded at 3413 (offset 22 lines).
Hunk #7 succeeded at 3452 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3315 (offset 22 lines).
Hunk #2 succeeded at 3336 (offset 22 lines).
Hunk #3 succeeded at 3391 (offset 22 lines).
Hunk #4 succeeded at 4682 (offset 31 lines).
patching file arch/x86/mm/fault.c
patching file kernel/fork.c
patching file include/linux/vm_event.h
patching file include/linux/vmstat.h
patching file arch/x86/mm/fault.c
patching file include/linux/mmap_lock.h
patching file include/linux/vm_event.h
patching file include/linux/vm_event_item.h
patching file mm/Kconfig.debug
patching file mm/memory.c
Hunk #1 succeeded at 2784 (offset 22 lines).
Hunk #2 succeeded at 2798 (offset 22 lines).
Hunk #3 succeeded at 2818 (offset 22 lines).
Hunk #4 succeeded at 3119 (offset 22 lines).
Hunk #5 succeeded at 3396 (offset 22 lines).
Hunk #6 succeeded at 3654 (offset 22 lines).
Hunk #7 succeeded at 3887 (offset 22 lines).
Hunk #8 succeeded at 3919 (offset 22 lines).
Hunk #9 succeeded at 3965 (offset 22 lines).
Hunk #10 succeeded at 4521 (offset 31 lines).
Hunk #11 succeeded at 4705 (offset 31 lines).
Hunk #12 succeeded at 4775 (offset 31 lines).
Hunk #13 succeeded at 4812 (offset 31 lines).
patching file mm/vmstat.c
Hunk #1 succeeded at 1395 (offset 1 line).
patching file arch/arm64/Kconfig
patching file arch/arm64/mm/fault.c
patching file arch/powerpc/Kconfig
patching file arch/powerpc/mm/fault.c
---> patching source with ../0001-UKSM-for-5.17.patch <---
patching file Documentation/vm/uksm.txt
patching file fs/exec.c
patching file fs/proc/meminfo.c
patching file include/linux/ksm.h
patching file include/linux/mm_types.h
patching file include/linux/mmzone.h
patching file include/linux/pgtable.h
patching file include/linux/sradix-tree.h
patching file include/linux/uksm.h
patching file kernel/fork.c
patching file lib/Makefile
patching file lib/sradix-tree.c
patching file mm/Kconfig
patching file mm/Makefile
patching file mm/ksm.c
patching file mm/memory.c
Hunk #4 succeeded at 1404 (offset 15 lines).
Hunk #5 succeeded at 2905 (offset 22 lines).
Hunk #6 succeeded at 3160 (offset 22 lines).
Hunk #7 succeeded at 3212 (offset 22 lines).
patching file mm/mmap.c
patching file mm/uksm.c
patching file mm/vmstat.c
Hunk #1 succeeded at 1244 (offset 1 line)
lucjan at archlinux ~/Poczekalnia/Patchmaker/trunk-v1/src/linux-5.17.3 13:54:31 02cd66ae master    
❯ git am *.patch   
Applying: mm: export dump_mm
Applying: mmap locking API: mmap_lock_is_contended returns a bool
Applying: mmap locking API: name the return values
Applying: do_anonymous_page: use update_mmu_tlb()
Applying: do_anonymous_page: reduce code duplication
Applying: mm: introduce CONFIG_SPECULATIVE_PAGE_FAULT
Applying: x86/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
Applying: mm: add FAULT_FLAG_SPECULATIVE flag
Applying: mm: add do_handle_mm_fault()
Applying: mm: add per-mm mmap sequence counter for speculative page fault handling.
Applying: mm: rcu safe vma freeing
Applying: mm: separate mmap locked assertion from find_vma
Applying: x86/mm: attempt speculative mm faults first
Applying: mm: add speculative_page_walk_begin() and speculative_page_walk_end()
Applying: mm: refactor __handle_mm_fault() / handle_pte_fault()
Applying: mm: implement speculative handling in __handle_mm_fault().
Applying: mm: add pte_map_lock() and pte_spinlock()
Applying: mm: implement speculative handling in do_anonymous_page()
Applying: mm: enable speculative fault handling through do_anonymous_page()
Applying: mm: implement speculative handling in do_numa_page()
Applying: mm: enable speculative fault handling in do_numa_page()
Applying: percpu-rwsem: enable percpu_sem destruction in atomic context
Applying: mm: add mmu_notifier_lock
Applying: mm: write lock mmu_notifier_lock when registering mmu notifiers
Applying: mm: add mmu_notifier_trylock() and mmu_notifier_unlock()
Applying: mm: implement speculative handling in wp_page_copy()
Applying: mm: implement and enable speculative fault handling in handle_pte_fault()
Applying: mm: disable speculative faults for single threaded user space
Applying: mm: disable rcu safe vma freeing for single threaded user space
Applying: mm: create new include/linux/vm_event.h header file
Applying: mm: anon spf statistics
Applying: arm64/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
Applying: arm64/mm: attempt speculative mm faults first
Applying: powerpc/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
Applying: powerpc/mm: attempt speculative mm faults first
Applying: UKSM for 5.17
.git/rebase-apply/patch:6938: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
  1. MGLRU + Speculative + UKSM
lucjan at archlinux ~ 13:50:17    
❯ patchmaker-trunk-v1
---> patching source with ../0001-lru-patches.patch <---
patching file arch/arm64/include/asm/pgtable.h
patching file arch/x86/include/asm/pgtable.h
patching file include/linux/pgtable.h
patching file mm/memory.c
Hunk #2 succeeded at 2788 (offset 22 lines).
patching file arch/Kconfig
Hunk #1 succeeded at 1323 (offset 1 line).
patching file arch/x86/Kconfig
patching file arch/x86/include/asm/pgtable.h
patching file arch/x86/mm/pgtable.c
patching file include/linux/pgtable.h
patching file mm/vmscan.c
patching file include/linux/mm_inline.h
patching file fs/fuse/dev.c
patching file include/linux/mm.h
patching file include/linux/mm_inline.h
patching file include/linux/mmzone.h
patching file include/linux/page-flags-layout.h
patching file include/linux/page-flags.h
patching file include/linux/sched.h
patching file kernel/bounds.c
patching file mm/Kconfig
patching file mm/huge_memory.c
patching file mm/memcontrol.c
patching file mm/memory.c
Hunk #1 succeeded at 4785 (offset 31 lines).
Hunk #2 succeeded at 4837 (offset 31 lines).
patching file mm/mm_init.c
patching file mm/mmzone.c
patching file mm/swap.c
patching file mm/vmscan.c
patching file include/linux/mm.h
patching file include/linux/mm_inline.h
patching file include/linux/mmzone.h
patching file kernel/bounds.c
patching file mm/Kconfig
patching file mm/swap.c
patching file mm/vmscan.c
patching file mm/workingset.c
patching file include/linux/memcontrol.h
patching file include/linux/mm.h
patching file include/linux/mmzone.h
patching file include/linux/swap.h
patching file mm/memcontrol.c
patching file mm/rmap.c
patching file mm/swap.c
patching file mm/vmscan.c
patching file fs/exec.c
Hunk #1 succeeded at 1012 (offset 6 lines).
Hunk #2 succeeded at 1025 (offset 6 lines).
patching file include/linux/memcontrol.h
patching file include/linux/mm_types.h
patching file include/linux/mmzone.h
patching file include/linux/swap.h
patching file kernel/exit.c
patching file kernel/fork.c
patching file kernel/sched/core.c
Hunk #1 succeeded at 4980 (offset 1 line).
patching file mm/memcontrol.c
patching file mm/vmscan.c
patching file mm/vmscan.c
patching file include/linux/cgroup.h
patching file include/linux/mm_inline.h
patching file include/linux/mmzone.h
patching file kernel/cgroup/cgroup-internal.h
patching file mm/Kconfig
patching file mm/vmscan.c
patching file include/linux/mmzone.h
patching file mm/vmscan.c
patching file include/linux/nodemask.h
patching file mm/vmscan.c
patching file Documentation/admin-guide/mm/index.rst
patching file Documentation/admin-guide/mm/multigen_lru.rst
patching file mm/Kconfig
patching file Documentation/vm/index.rst
patching file Documentation/vm/multigen_lru.rst
patching file Documentation/admin-guide/kernel-parameters.txt
Hunk #1 succeeded at 6260 (offset -1 lines).
patching file Documentation/admin-guide/sysctl/vm.rst
patching file kernel/sysctl.c
patching file mm/Kconfig
patching file mm/vmscan.c
---> patching source with ../0001-speculative-patches.patch <---
patching file mm/debug.c
patching file include/linux/mmap_lock.h
patching file include/linux/mmap_lock.h
patching file mm/memory.c
Hunk #1 succeeded at 3809 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3736 (offset 22 lines).
Hunk #2 succeeded at 3766 (offset 22 lines).
patching file mm/Kconfig
patching file arch/x86/Kconfig
patching file include/linux/mm.h
patching file include/linux/mm_types.h
patching file include/linux/mm.h
patching file mm/memory.c
Hunk #1 succeeded at 4801 (offset 31 lines).
Hunk #2 succeeded at 4855 (offset 31 lines).
patching file include/linux/mm_types.h
patching file include/linux/mmap_lock.h
patching file include/linux/mm_types.h
patching file kernel/fork.c
patching file drivers/gpu/drm/i915/i915_gpu_error.c
patching file include/linux/mm.h
patching file mm/mmap.c
patching file arch/x86/mm/fault.c
patching file include/linux/mm_types.h
patching file include/linux/vm_event_item.h
patching file mm/vmstat.c
Hunk #1 succeeded at 1391 (offset 1 line).
patching file mm/memory.c
Hunk #1 succeeded at 2735 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3779 (offset 22 lines).
Hunk #2 succeeded at 4081 (offset 31 lines).
Hunk #3 succeeded at 4546 (offset 31 lines).
Hunk #4 succeeded at 4685 (offset 31 lines).
patching file include/linux/mm.h
patching file mm/memory.c
Hunk #1 succeeded at 4600 (offset 31 lines).
Hunk #2 succeeded at 4615 (offset 31 lines).
Hunk #3 succeeded at 4930 (offset 31 lines).
patching file include/linux/mm.h
patching file mm/memory.c
Hunk #1 succeeded at 2755 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3856 (offset 22 lines).
Hunk #2 succeeded at 3883 (offset 22 lines).
Hunk #3 succeeded at 3901 (offset 22 lines).
Hunk #4 succeeded at 3920 (offset 22 lines).
patching file arch/x86/mm/fault.c
patching file mm/memory.c
Hunk #1 succeeded at 4384 (offset 31 lines).
Hunk #2 succeeded at 4630 (offset 31 lines).
Hunk #3 succeeded at 4984 (offset 31 lines).
Hunk #4 succeeded at 5008 (offset 31 lines).
patching file mm/memory.c
Hunk #1 succeeded at 4460 (offset 31 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3599 (offset 22 lines).
Hunk #2 succeeded at 4635 (offset 31 lines).
patching file include/linux/percpu-rwsem.h
patching file kernel/locking/percpu-rwsem.c
patching file include/linux/mm_types.h
patching file include/linux/mmu_notifier.h
patching file kernel/fork.c
patching file mm/mmap.c
patching file include/linux/mmu_notifier.h
patching file mm/memory.c
Hunk #1 succeeded at 3097 (offset 22 lines).
Hunk #2 succeeded at 3134 (offset 22 lines).
Hunk #3 succeeded at 3152 (offset 22 lines).
Hunk #4 succeeded at 3231 (offset 22 lines).
Hunk #5 succeeded at 3249 (offset 22 lines).
Hunk #6 succeeded at 3401 (offset 22 lines).
Hunk #7 succeeded at 3440 (offset 22 lines).
patching file mm/memory.c
Hunk #1 succeeded at 3303 (offset 22 lines).
Hunk #2 succeeded at 3324 (offset 22 lines).
Hunk #3 succeeded at 3379 (offset 22 lines).
Hunk #4 succeeded at 4670 (offset 31 lines).
patching file arch/x86/mm/fault.c
patching file kernel/fork.c
patching file include/linux/vm_event.h
patching file include/linux/vmstat.h
patching file arch/x86/mm/fault.c
patching file include/linux/mmap_lock.h
patching file include/linux/vm_event.h
patching file include/linux/vm_event_item.h
patching file mm/Kconfig.debug
patching file mm/memory.c
Hunk #1 succeeded at 2772 (offset 22 lines).
Hunk #2 succeeded at 2786 (offset 22 lines).
Hunk #3 succeeded at 2806 (offset 22 lines).
Hunk #4 succeeded at 3107 (offset 22 lines).
Hunk #5 succeeded at 3384 (offset 22 lines).
Hunk #6 succeeded at 3642 (offset 22 lines).
Hunk #7 succeeded at 3875 (offset 22 lines).
Hunk #8 succeeded at 3907 (offset 22 lines).
Hunk #9 succeeded at 3953 (offset 22 lines).
Hunk #10 succeeded at 4509 (offset 31 lines).
Hunk #11 succeeded at 4693 (offset 31 lines).
Hunk #12 succeeded at 4763 (offset 31 lines).
Hunk #13 succeeded at 4800 (offset 31 lines).
patching file mm/vmstat.c
Hunk #1 succeeded at 1395 (offset 1 line).
patching file arch/arm64/Kconfig
patching file arch/arm64/mm/fault.c
patching file arch/powerpc/Kconfig
patching file arch/powerpc/mm/fault.c
---> patching source with ../0001-UKSM-for-5.17.patch <---
patching file Documentation/vm/uksm.txt
patching file fs/exec.c
patching file fs/proc/meminfo.c
patching file include/linux/ksm.h
patching file include/linux/mm_types.h
Hunk #1 succeeded at 466 (offset 3 lines).
patching file include/linux/mmzone.h
patching file include/linux/pgtable.h
Hunk #1 succeeded at 1159 (offset 13 lines).
Hunk #2 succeeded at 1187 (offset 13 lines).
patching file include/linux/sradix-tree.h
patching file include/linux/uksm.h
patching file kernel/fork.c
patching file lib/Makefile
patching file lib/sradix-tree.c
patching file mm/Kconfig
Hunk #1 succeeded at 367 (offset 63 lines).
patching file mm/Makefile
patching file mm/ksm.c
patching file mm/memory.c
Hunk #1 succeeded at 146 (offset -12 lines).
Hunk #2 succeeded at 180 (offset -12 lines).
Hunk #3 succeeded at 966 (offset -12 lines).
Hunk #4 succeeded at 1392 (offset 3 lines).
Hunk #5 succeeded at 2893 (offset 10 lines).
Hunk #6 succeeded at 3148 (offset 10 lines).
Hunk #7 succeeded at 3200 (offset 10 lines).
patching file mm/mmap.c
patching file mm/uksm.c
patching file mm/vmstat.c
Hunk #1 succeeded at 1244 (offset 1 line).
lucjan at archlinux ~/Poczekalnia/Patchmaker/trunk-v1/src/linux-5.17.3 13:53:22 02cd66ae master    
❯ git am *.patch
Applying: mm: x86, arm64: add arch_has_hw_pte_young()
Applying: mm: x86: add CONFIG_ARCH_HAS_NONLEAF_PMD_YOUNG
Applying: mm/vmscan.c: refactor shrink_node()
Applying: Revert "include/linux/mm_inline.h: fold __update_lru_size() into its sole caller"
Applying: mm: multi-gen LRU: groundwork
Applying: mm: multi-gen LRU: minimal implementation
Applying: mm: multi-gen LRU: exploit locality in rmap
Applying: mm: multi-gen LRU: support page table walks
Applying: mm: multi-gen LRU: optimize multiple memcgs
Applying: mm: multi-gen LRU: kill switch
Applying: mm: multi-gen LRU: thrashing prevention
Applying: mm: multi-gen LRU: debugfs interface
Applying: mm: multi-gen LRU: admin guide
Applying: mm: multi-gen LRU: design doc
Applying: mm-5.17: protect mappings under memory pressure
Applying: mm: export dump_mm
Applying: mmap locking API: mmap_lock_is_contended returns a bool
Applying: mmap locking API: name the return values
Applying: do_anonymous_page: use update_mmu_tlb()
Applying: do_anonymous_page: reduce code duplication
Applying: mm: introduce CONFIG_SPECULATIVE_PAGE_FAULT
Applying: x86/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
Applying: mm: add FAULT_FLAG_SPECULATIVE flag
Applying: mm: add do_handle_mm_fault()
Applying: mm: add per-mm mmap sequence counter for speculative page fault handling.
Applying: mm: rcu safe vma freeing
Applying: mm: separate mmap locked assertion from find_vma
Applying: x86/mm: attempt speculative mm faults first
Applying: mm: add speculative_page_walk_begin() and speculative_page_walk_end()
Applying: mm: refactor __handle_mm_fault() / handle_pte_fault()
Applying: mm: implement speculative handling in __handle_mm_fault().
Applying: mm: add pte_map_lock() and pte_spinlock()
Applying: mm: implement speculative handling in do_anonymous_page()
Applying: mm: enable speculative fault handling through do_anonymous_page()
Applying: mm: implement speculative handling in do_numa_page()
Applying: mm: enable speculative fault handling in do_numa_page()
Applying: percpu-rwsem: enable percpu_sem destruction in atomic context
Applying: mm: add mmu_notifier_lock
Applying: mm: write lock mmu_notifier_lock when registering mmu notifiers
Applying: mm: add mmu_notifier_trylock() and mmu_notifier_unlock()
Applying: mm: implement speculative handling in wp_page_copy()
Applying: mm: implement and enable speculative fault handling in handle_pte_fault()
Applying: mm: disable speculative faults for single threaded user space
Applying: mm: disable rcu safe vma freeing for single threaded user space
Applying: mm: create new include/linux/vm_event.h header file
Applying: mm: anon spf statistics
Applying: arm64/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
Applying: arm64/mm: attempt speculative mm faults first
Applying: powerpc/mm: define ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
Applying: powerpc/mm: attempt speculative mm faults first
Applying: UKSM for 5.17
.git/rebase-apply/patch:6938: new blank line at EOF.
+
warning: 1 line adds whitespace errors.

Tested on 5.17.3.

commented

I've tested the UKSM-Speculative-v2 patch as I also use the Speculative-LRU patch (but I don't even get that far, as I apply the UKSM patch right after the Xanmod-patch). This is all with the Xanmod-5.17.3 sources.

Adding the rejected file:
memory.c.rej.txt

I get the following output:

patching file fs/proc/meminfo.c
patching file include/linux/ksm.h
patching file include/linux/mm_types.h
Hunk #1 succeeded at 455 (offset -8 lines).
patching file include/linux/mmzone.h
patching file include/linux/pgtable.h
Hunk #1 succeeded at 1159 (offset 13 lines).
Hunk #2 succeeded at 1187 (offset 13 lines).
patching file include/linux/sradix-tree.h
patching file include/linux/uksm.h
patching file kernel/fork.c
Hunk #1 succeeded at 611 (offset -10 lines).
patching file lib/Makefile
patching file lib/sradix-tree.c
patching file mm/Kconfig
Hunk #1 succeeded at 367 (offset 63 lines).
patching file mm/Makefile
patching file mm/ksm.c
patching file mm/memory.c
Hunk #1 succeeded at 146 (offset -12 lines).
Hunk #2 succeeded at 180 (offset -12 lines).
Hunk #3 succeeded at 966 (offset -12 lines).
Hunk #4 succeeded at 1392 (offset 3 lines).
Hunk #5 succeeded at 2800 (offset -83 lines).
Hunk #6 FAILED at 3138.
Hunk #7 succeeded at 3089 (offset -100 lines).
1 out of 7 hunks FAILED -- saving rejects to file mm/memory.c.rej
patching file mm/mmap.c
Hunk #10 succeeded at 2768 (offset 1 line).
Hunk #11 succeeded at 3059 (offset 1 line).
Hunk #12 succeeded at 3105 (offset 1 line).
Hunk #13 succeeded at 3211 (offset 1 line).
Hunk #14 succeeded at 3322 (offset 1 line).
Hunk #15 succeeded at 3487 (offset 1 line).
patching file mm/uksm.c
patching file mm/vmstat.c
Hunk #1 succeeded at 1244 (offset 1 line).
==> FEHLER: Ein Fehler geschah in prepare().
    Breche ab...
```
commented

My current theory is, that this might occur due to an older MGLRU patchset which Xanmod carries by default.

commented

For easy reproduction, you just need to add the UKSM patch right after the Xanmod-patch is applied in the following PKGBUILD: https://github.com/ms178/archpkgbuilds/blob/main/packages/linux-xanmod-edge/PKGBUILD

I do not use Xanmod and have never applied patches to this kernel. Perhaps some patch from Xanmod conflicts with UKSM. Everything works fine for me.