All of lore.kernel.org
 help / color / mirror / Atom feed
From: CGEL <cgel.zte@gmail.com>
To: Balbir Singh <bsingharora@gmail.com>
Cc: akpm@linux-foundation.org, ammarfaizi2@gnuweeb.org,
	oleksandr@natalenko.name, willy@infradead.org,
	linux-mm@kvack.org, corbet@lwn.net, linux-kernel@vger.kernel.org,
	xu xin <xu.xin16@zte.com.cn>, Yang Yang <yang.yang29@zte.com.cn>,
	Ran Xiaokai <ran.xiaokai@zte.com.cn>,
	wangyong <wang.yong12@zte.com.cn>,
	Yunkai Zhang <zhang.yunkai@zte.com.cn>,
	Jiang Xuexin <jiang.xuexin@zte.com.cn>
Subject: Re: [PATCH] mm/ksm: introduce ksm_enabled for each processg
Date: Wed, 18 May 2022 07:40:30 +0000	[thread overview]
Message-ID: <6284a2ef.1c69fb81.e53cd.32b2@mx.google.com> (raw)
In-Reply-To: <YoSZE7Iak3AYA4VE@balbir-desktop>

On Wed, May 18, 2022 at 04:58:27PM +1000, Balbir Singh wrote:
> On Tue, May 17, 2022 at 09:27:01AM +0000, cgel.zte@gmail.com wrote:
> > From: xu xin <xu.xin16@zte.com.cn>
> > 
> > For now, if we want to use KSM to merge pages of some apps, we have to
> > explicitly call madvise() in application code, which means installed
> > apps on OS needs to be uninstall and source code needs to be modified.
> > It is very inconvenient because sometimes users or app developers are not
> > willing to modify their app source codes for any reasons.
> >
> 
> I thought we got process_madvise in 5.13, doesn't that help solve the
> problem with extensions to advice and an appropriate wrapper? Granted
> it might be a little racy with a running process potentially
> participating in KSM already. 

The reasons why I don't use process_madvise to achieve this include:

1. see https://lore.kernel.org/lkml/1835064.A2aMcgg3dW@natalenko.name/

2. process_madvise is still a kind of madvise. processs_madvise from
another process overrides the intention of origin app code ifself that
also calls madvise, which is unrecoverable. For example, if a process "A"
which madvises just one part of VMAs (not all) as MERGEABLE run on the OS
already, meanwhile, if another process which doesn't know the information
of "A" 's MERGEABLE areas, then call process_madvise to advise all VMAs of
"A" as MERGEABLE, the original MERGEABLE information of "A" calling madivse
is erasured permanently.

> If we are concerned about KSM, I would assume that we care about long running processes, is that true?
> 

Yes, it is.

> Balbir Singh

  reply	other threads:[~2022-05-18  7:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  9:27 [PATCH] mm/ksm: introduce ksm_enabled for each process cgel.zte
2022-05-17 14:04 ` Michal Hocko
2022-05-18  2:47   ` CGEL
2022-05-18 12:12     ` Michal Hocko
2022-05-19  6:23       ` CGEL
2022-05-19  7:35         ` Michal Hocko
2022-05-19  8:02           ` CGEL
2022-05-19  8:24             ` Michal Hocko
2022-05-18  6:58 ` Balbir Singh
2022-05-18  7:40   ` CGEL [this message]
2022-05-18 12:14     ` [PATCH] mm/ksm: introduce ksm_enabled for each processg Michal Hocko
2022-05-19  6:35       ` CGEL
2022-05-19  7:39         ` Michal Hocko
2022-05-24  8:52           ` CGEL
2022-05-24  9:04             ` Michal Hocko
2022-05-25  6:56               ` CGEL
2022-05-25  7:38                 ` Michal Hocko
2022-05-18 14:31 ` [PATCH] mm/ksm: introduce ksm_enabled for each process Jann Horn
2022-05-19  3:39   ` CGEL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6284a2ef.1c69fb81.e53cd.32b2@mx.google.com \
    --to=cgel.zte@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ammarfaizi2@gnuweeb.org \
    --cc=bsingharora@gmail.com \
    --cc=corbet@lwn.net \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=oleksandr@natalenko.name \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=wang.yong12@zte.com.cn \
    --cc=willy@infradead.org \
    --cc=xu.xin16@zte.com.cn \
    --cc=yang.yang29@zte.com.cn \
    --cc=zhang.yunkai@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.