Re: [PATCH v6 1/3] mm: add new api to enable ksm per process

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12.04.23 21:55, Stefan Roesch wrote:

David Hildenbrand <david@xxxxxxxxxx> writes:

On 12.04.23 20:41, David Hildenbrand wrote:
[...]
That will work.
work? IOW, not exporting ksm_add_mm() and not passing a flag to __ksm_enter() --
it would simply set MMF_VM_MERGEABLE ?


ksm_add_mm() is also used in prctl (kernel/sys.c). Do you want to make a
similar change there?
Yes.

+ *
+ * @vma:  Pointer to vma
+ */
+void ksm_add_vma(struct vm_area_struct *vma)
+{
+	struct mm_struct *mm = vma->vm_mm;
+
+	if (test_bit(MMF_VM_MERGE_ANY, &mm->flags))
+		__ksm_add_vma(vma);
+}
+
+/**
+ * ksm_add_vmas - Mark all vma's of a process as mergeable
+ *
+ * @mm:  Pointer to mm
+ */
+void ksm_add_vmas(struct mm_struct *mm)

I'd suggest calling this

I guess you forgot your name suggestion?
Yeah, I reconsidered because the first idea I had was not particularly
good. Maybe
ksm_enable_for_all_vmas()
But not so sure. If you think the "add" terminology is a good fit, keep
it like that.
Thanks for bearing with me :)


I briefly played with your patch to see how much it can be simplified.
Always enabling ksm (setting MMF_VM_MERGEABLE) before setting
MMF_VM_MERGE_ANY might simplify things. ksm_enable_merge_any() [or however it should
be called] and ksm_fork() contain the interesting bits.


Feel free to incorporate what you consider valuable (uncompiled,
untested).

I added most of it. The only change is that I kept ksm_add_vmas as a
static function, otherwise I need to define the VMA_ITERATOR at the top
of the function.


Makes sense. I'll review patch #3 later, so we can hopefully get this into the 6.4 merge window after letting it rest at least some days in -next.

--
Thanks,

David / dhildenb




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux