dolohow / uksm

Ultra Kernel Samepage Merging
242 stars 35 forks source link

failing to apply a patch on Ubuntu 5.4 kernel #66

Closed hellt closed 3 years ago

hellt commented 3 years ago

Hi, Can you please tell me if I am doing something wrong when trying to patch Ubuntu 5.4 kernel with UKSM support?

git clone --depth 1 --single-branch --branch Ubuntu-5.4.0-66.74 https://git.launchpad.net/\~ubuntu-kernel/ubuntu/+source/linux/+git/focal

cd focal

# start patch
root@kernel-build:~/focal# patch -p1 < ~/uksm/v5.x/uksm-5.4.patch
patching file Documentation/vm/uksm.txt
patching file fs/exec.c
Hunk #1 succeeded at 63 with fuzz 2.
patching file fs/proc/meminfo.c
patching file include/asm-generic/pgtable.h
patching file include/linux/ksm.h
patching file include/linux/mm_types.h
Hunk #1 succeeded at 355 (offset 2 lines).
patching file include/linux/mmzone.h
patching file include/linux/sradix-tree.h
patching file include/linux/uksm.h
patching file kernel/fork.c
Hunk #1 succeeded at 600 (offset 5 lines).
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 #1 succeeded at 142 (offset 12 lines).
Hunk #2 succeeded at 172 (offset 12 lines).
Hunk #3 succeeded at 804 (offset 12 lines).
Hunk #4 succeeded at 1083 (offset 12 lines).
Hunk #5 FAILED at 2196.
Hunk #6 succeeded at 2446 (offset 97 lines).
Hunk #7 succeeded at 2488 (offset 109 lines).
1 out of 7 hunks FAILED -- saving rejects to file mm/memory.c.rej
patching file mm/mmap.c
Hunk #2 succeeded at 179 with fuzz 2 (offset -6 lines).
Hunk #3 succeeded at 730 (offset -8 lines).
Hunk #4 succeeded at 872 (offset -8 lines).
Hunk #5 succeeded at 978 (offset -8 lines).
Hunk #6 succeeded at 1005 (offset -8 lines).
Hunk #7 succeeded at 1472 (offset -8 lines).
Hunk #8 succeeded at 1843 (offset -10 lines).
Hunk #9 succeeded at 1886 (offset -10 lines).
Hunk #10 succeeded at 2729 (offset 3 lines).
Hunk #11 succeeded at 3054 (offset 21 lines).
Hunk #12 succeeded at 3105 (offset 21 lines).
Hunk #13 succeeded at 3183 (offset 21 lines).
Hunk #14 succeeded at 3224 with fuzz 1 (offset 22 lines).
Hunk #15 succeeded at 3336 (offset 22 lines).
Hunk #16 succeeded at 3487 (offset 22 lines).
patching file mm/uksm.c
patching file mm/vmstat.c
root@kernel-build:~/focal# cat mm/memory.c.
memory.c.orig  memory.c.rej
root@kernel-build:~/focal# cat mm/memory.c.
memory.c.orig  memory.c.rej
root@kernel-build:~/focal# cat mm/memory.c.
memory.c.orig  memory.c.rej

# check reject
root@kernel-build:~/focal# cat mm/memory.c.rej
--- mm/memory.c
+++ mm/memory.c
@@ -2196,8 +2223,10 @@ static inline void cow_user_page(struct page *dst, struct page *src, unsigned lo
            clear_page(kaddr);
        kunmap_atomic(kaddr);
        flush_dcache_page(dst);
-   } else
+   } else {
        copy_user_highpage(dst, src, va, vma);
+       uksm_cow_page(vma, src);
+   }
 }

 static gfp_t __get_fault_gfp_mask(struct vm_area_struct *vma)
dolohow commented 3 years ago

UKSM is only supported for vanilla sources from kernel.org without any other patches applied on them. They might work, though. You can try 5.5 patch, no idea if that would work. Ubuntu back ported some changes. Also, there is a new Ubuntu hwe kernel created from 5.8 branch, you can try that as well if possible.

Hope that helps.

hellt commented 3 years ago

Thanks, I seems successfully applied the 5.4 path on the Ubuntu-5.4.0-48 kernel. At least patch didn't throw any fails. Building the kernel now to see if it'll fly

On Wed, Feb 17, 2021 at 6:38 PM Łukasz Żarnowiecki notifications@github.com wrote:

UKSM is only supported for vanilla sources from kernel.org without any other patches applied on them. They might work, though. You can try 5.5 patch, no idea if that would work. Ubuntu back ported some changes. Also, there is a new Ubuntu hwe kernel created from 5.8 branch, you can try that as well if possible.

Hope that helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dolohow/uksm/issues/66#issuecomment-780726508, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLKV5MC3M6EHMVI2CIKGA3S7P5KPANCNFSM4XYRB6DQ .