On Thu, May 19, 2022 at 09:35:30AM +0200, Michal Hocko wrote: > On Thu 19-05-22 06:23:30, CGEL wrote: > > On Wed, May 18, 2022 at 02:12:26PM +0200, Michal Hocko wrote: > > > On Wed 18-05-22 02:47:06, CGEL wrote: > > > > On Tue, May 17, 2022 at 04:04:38PM +0200, Michal Hocko wrote: > > > > > [CCing Hugh and linux-api] > > > > > > > > > > On Tue 17-05-22 09:27:01, cgel.zte@xxxxxxxxx wrote: > > > > > per mm but the actual implementation currently relies on the per-vma > > > > > flags. That means that one can explicitly disallow merging by madvise > > > > > for a range. Is it wise to override that by a per-process knob? I mean > > > > > there might be a very good reason why a particular memory ranges should > > > > > never be merged but a per-process knob could easily ignore that hint > > > > > from the application. Or am I just confuse? > > > > For now, there is no any hints for letting KSM never merge some memory > > > > ranges. > > > > > > I am not sure I understand. Could you be more specific? > > > > Not like THP, KSM doesn't have anything like VM_NOHUGEPAGE, so apps > > cann't explicitly disallow merging by madvise. If it is really necessary for > > a particular meory ranges of a process to be never merged, we have to submit > > one more patch to achieve that. > > What about MADV_UNMERGEABLE? MADV_UNMERGEABLE and MADV_MERGEABLE usually appear in pairs, MADV_UNMERGEABLE cannot appear alone. I mean MADV_UNMERGEABLE is used to unmerges whatever it merged in the specifed range, not to disallow merging. > -- > Michal Hocko > SUSE Labs