lkml.org 
[lkml]   [2009]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 13/12] ksm: fix munlock during exit_mmap deadlock
Andrea Arcangeli wrote:
> On Wed, Aug 26, 2009 at 11:54:36PM +0300, Izik Eidus wrote:
>
>> But before getting into this, why is it so important to break the ksm
>> pages when madvise(UNMERGEABLE) get called?
>>
>
> The moment ksm pages are swappable, there's no apparent reason why
> anybody should ask the kernel to break any ksm page if the application
> themselfs aren't writing to them in the first place (triggering
> copy-on-write in app context which already handles TIF_MEMDIE just
> fine).
>

I think I am the one that should be blamed for breaking the ksm pages
when running unmeregable (If I remember right),
but I think Hugh had a good case why we want to keep it... ? (If I
remember right again...)

> In oom deadlock terms madvise(UNMERGEABLE) is the only place that is
> 100% fine at breaking KSM pages, because it runs with right tsk->mm
> and page allocation will notice TIF_MEMDIE set on tsk.
>
> If we remove "echo 2" only remaining "unsafe" spot is the break_cow in
> kksmd context when memcmp fails and similar during the scan.
>
>
I didnt talk here about the bug..., I talked about the behavior...
It is the feeling that the oom will kill applications calling into
UNMERGEABLE, even thought this application shouldn't die, just because
it had big amount of memory shared and it unmerged it in the wrong time?...

But probably this thoughts have no end, and we are better stick with
something practical that can work clean and simple...

So what I think is this:
echo 2 is something we want in this version beacuse we dont support
swapping of the shared pages, so we got to allow some how to break the
pages...

and echo 2 got to have UNMERGEABLE break the shared pages when its
madvise get called...

So maybe it is just better to leave it like that?
>> When thinking about it, lets say I want to use ksm to scan 2
>> applications and merged their STATIC identical data, and then i want to
>> stop scanning them after i know ksm merged the pages, as soon as i will
>> try to unregister this 2 applications ksm will unmerge the pages, so we
>> dont allow such thing for the user (we can tell him ofcurse for such
>> case to use normal way of sharing, so this isnt a really strong case for
>> this)
>>
>
> For the app it will be tricky to know when the pages are merged
> though, right now it could only wait a "while"... so I don't really
> see madvise(UNMERGEABLE) as useful regardless how we implement
> it... but then this goes beyond the scope of this bug because as said
> madvise(UNMERGEABLE) is the only place that breaks ksm pages as safe
> as regular write fault in oom context because of it running in the
> process context (not echo 2 or kksmd context).
>
Yea, I agree about that this case was idiotic :), Actually I thought
about case where application get little bit more info, but leave it, it
is not worth it, traditional sharing is much better for such cases.


\
 
 \ /
  Last update: 2009-08-26 23:45    [W:0.072 / U:1.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site