[00:02] <bear38> Hi guys, I had a simple question. I'm trying to backport a commit to mm/zswap.c, the "same filled pages" change, to 4.15.X. I'm also backporting another change to z3fold.c. I heard in another channel that rebuilding the z3fold module would make my changes to both zswap.c, and z3fold.c take effect. But so far, only my changes to z3fold.c are having an effect.
[00:03] <bear38> So my question is, is there some way for me to patch zswap.c without rebuilding the entire kernel?
[07:31] <arighi> bear38: zswap and z3fold are two separate modules, in particular z3fold is one of the available compressed memory pool allocator that zswap can use, so patching z3fold can affect zswap if this specific memory allocator is used (check /sys/module/zswap/parameters/zpool). About recompiling the kernel, it depends what you're touching with the code that you're backporting, if you touch only zswap.c (and it seems to b
[07:31] <arighi> e "same filled pages" patch), recompiling the kernel should only rebuild the zswap module. Then to apply these changes you need to reboot, or remove and re-insert the zswap module, or use live-patching (but I wouldn't recommend using live patching with this particular change, it doesn't look safe at all, because the change is affecting zswap's metadata)
[16:50] <bear38> arighi: Thank you for that info. Apologies for being totally new at kernel hacking, but is zswap an actual module? I'm unable to find any .ko file with zswap in the title. I do see z3fold.ko, for the changes to that file. Do you have any guess about what module file I would need to rebuild in order to get my changes to zswap.c to take effect?
[20:26] <arighi> bear38: you're right! Looking at the code (zswap.c), it's written like a module, but if you look at CONFIG_ZSWAP in mm/Kconfig, it's defined as bool (not tristate, like any module), so it can be either compiled into the kernel or disabled. Probably the reason is because it requires a lot of internal kernel functions that are not exported to modules (with EXPORT_SYMBOL)