[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YoX+ps7fYFMqjQDq@dhcp22.suse.cz>
Date: Thu, 19 May 2022 10:24:06 +0200
From: Michal Hocko <mhocko@...e.com>
To: CGEL <cgel.zte@...il.com>
Cc: akpm@...ux-foundation.org, ammarfaizi2@...weeb.org,
oleksandr@...alenko.name, willy@...radead.org, linux-mm@...ck.org,
corbet@....net, linux-kernel@...r.kernel.org,
xu xin <xu.xin16@....com.cn>,
Yang Yang <yang.yang29@....com.cn>,
Ran Xiaokai <ran.xiaokai@....com.cn>,
wangyong <wang.yong12@....com.cn>,
Yunkai Zhang <zhang.yunkai@....com.cn>,
Jiang Xuexin <jiang.xuexin@....com.cn>,
Hugh Dickins <hughd@...gle.com>, linux-api@...r.kernel.org
Subject: Re: [PATCH] mm/ksm: introduce ksm_enabled for each process
On Thu 19-05-22 08:02:10, CGEL wrote:
> 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@...il.com 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.
That might be the case currently because KSM is an opt-in feature that
has to be explicitly enabled. The existing interface only allows to
enable it by MADV_MERGEABLE but now you are proposing an extension when
there would be other way to achieve the same (with a wider scope but
that is not really all that important). MADV_UNMERGEABLE has a well
defined behavior even on VMAs which are not marked for merging.
Let's say that somebody would like to use a process wide setup except
for few special mappings because merging is not really desirable for
whatever reason. How do you achieve that?
> I mean MADV_UNMERGEABLE is used to unmerges whatever it merged in the
> specifed range, not to disallow merging.
I disagree. It clearly drops the mergeable flag so it effectivelly disallow
merging.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists