Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-14 Thread Oleksandr Natalenko
Hi. On Tue, May 14, 2019 at 12:12:16PM +0300, Kirill Tkhai wrote: > > Immediate question: what should be actually done on this? I see 2 > > options: > > > > 1) mark all VMAs as mergeable + set some flag for mmap() to mark all > > further allocations as mergeable as well; > > 2) just mark all the

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-14 Thread Kirill Tkhai
On 14.05.2019 09:30, Oleksandr Natalenko wrote: > Hi. > > On Mon, May 13, 2019 at 03:37:56PM +0300, Kirill Tkhai wrote: >>> Yes, I get your point. But the intention is to avoid another hacky trick >>> (LD_PRELOAD), thus *something* should *preferably* be done on the >>> kernel level instead. >>

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-14 Thread Oleksandr Natalenko
Hi. On Mon, May 13, 2019 at 03:37:56PM +0300, Kirill Tkhai wrote: > > Yes, I get your point. But the intention is to avoid another hacky trick > > (LD_PRELOAD), thus *something* should *preferably* be done on the > > kernel level instead. > > I don't think so. Does userspace hack introduce some

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-13 Thread Kirill Tkhai
On 13.05.2019 14:33, Oleksandr Natalenko wrote: > Hi. > > On Mon, May 13, 2019 at 01:38:43PM +0300, Kirill Tkhai wrote: >> On 10.05.2019 10:21, Oleksandr Natalenko wrote: >>> By default, KSM works only on memory that is marked by madvise(). And the >>> only way to get around that is to either:

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-13 Thread Oleksandr Natalenko
On Mon, May 13, 2019 at 02:01:17PM +0200, Oleksandr Natalenko wrote: > On Mon, May 13, 2019 at 02:48:29PM +0300, Timofey Titovets wrote: > > > Also, just for the sake of another piece of stats here: > > > > > > $ echo "$(cat /sys/kernel/mm/ksm/pages_sharing) * 4 / 1024" | bc > > > 526 > > > >

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-13 Thread Oleksandr Natalenko
On Mon, May 13, 2019 at 02:48:29PM +0300, Timofey Titovets wrote: > > Also, just for the sake of another piece of stats here: > > > > $ echo "$(cat /sys/kernel/mm/ksm/pages_sharing) * 4 / 1024" | bc > > 526 > > IIRC, for calculate saving you must use (pages_shared - pages_sharing) Based on

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-13 Thread Timofey Titovets
пн, 13 мая 2019 г. в 14:33, Oleksandr Natalenko : > > Hi. > > On Mon, May 13, 2019 at 01:38:43PM +0300, Kirill Tkhai wrote: > > On 10.05.2019 10:21, Oleksandr Natalenko wrote: > > > By default, KSM works only on memory that is marked by madvise(). And the > > > only way to get around that is to

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-13 Thread Oleksandr Natalenko
Hi. On Mon, May 13, 2019 at 01:38:43PM +0300, Kirill Tkhai wrote: > On 10.05.2019 10:21, Oleksandr Natalenko wrote: > > By default, KSM works only on memory that is marked by madvise(). And the > > only way to get around that is to either: > > > > * use LD_PRELOAD; or > > * patch the kernel

Re: [PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-13 Thread Kirill Tkhai
Hi, Oleksandr, On 10.05.2019 10:21, Oleksandr Natalenko wrote: > By default, KSM works only on memory that is marked by madvise(). And the > only way to get around that is to either: > > * use LD_PRELOAD; or > * patch the kernel with something like UKSM or PKSM. > > Instead, lets implement a

[PATCH RFC 0/4] mm/ksm: add option to automerge VMAs

2019-05-10 Thread Oleksandr Natalenko
By default, KSM works only on memory that is marked by madvise(). And the only way to get around that is to either: * use LD_PRELOAD; or * patch the kernel with something like UKSM or PKSM. Instead, lets implement a so-called "always" mode, which allows marking VMAs as mergeable on