linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Timofey Titovets <timofey.titovets@synesis.ru>
To: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH V3] KSM: allow dedup all tasks memory
Date: Wed, 14 Nov 2018 01:55:04 +0300	[thread overview]
Message-ID: <CAGqmi74uqeqxD4n=pb=3v48sSfk-pQhk7eTHkuTLxegFAq-D9A@mail.gmail.com> (raw)
In-Reply-To: <CA+CK2bB0C-PCdaHS7YiLf5iZWn1bATg2y32ogL1FSw7LY9E7SQ@mail.gmail.com>

вт, 13 нояб. 2018 г. в 21:43, Pavel Tatashin <pasha.tatashin@soleen.com>:
>
> > > Is it really necessary to have an extra thread in ksm just to add vma's
> > > for scanning? Can we do it right from the scanner thread? Also, may be
> > > it is better to add vma's at their creation time when KSM_MODE_ALWAYS is
> > > enabled?
> > >
> > > Thank you,
> > > Pasha
> >
> > Oh, thats a long story, and my english to bad for describe all things,
> > even that hard to find linux-mm conversation several years ago about that.
> >
> > Anyway, so:
> > In V2 - i use scanner thread to add VMA, but i think scanner do that
> > with too high rate.
> > i.e. walk on task list, and get new task every 20ms, to wait write semaphore,
> > to get VMA...
> > To high rate for task list scanner, i think it's overkill.
> >
> > About add VMA from creation time,
> > UKSM add ksm_enter() hooks to mm subsystem, i port that to KSM.
> > But some mm people say what they not like add KSM hooks to other subsystems.
> > And want ksm do that internally by some way.
> >
> > Frankly speaking i didn't have enough knowledge and skills to do that
> > another way in past time.
> > They also suggest me look to THP for that logic, but i can't find how
> > THP do that without hooks, and
> > where THP truly scan memory.
> >
> > So, after all of that i implemented this in that way.
> > In first iteration as part of ksm scan thread, and in second, by
> > separate thread.
> > Because that allow to add VMA in fully independent way.
>
> It still feels as a wrong direction. A new thread that adds random
> VMA's to scan, and no way to optimize the queue fairness for example.
> It should really be done at creation time, when VMA is created it
> should be added to KSM scanning queue, or KSM main scanner thread
> should go through VMA list in a coherent order.

How you see queue fairness in that case?
i.e. if you talk about moving from old VMA to new VMA,
IIRC i can't find any whole kernel list of VMAs.

i.e. i really understood what you don't like exactly,
but for that we need add hooks as i already mentioned above.
(And i already try get that to kernel [1]).

So, as i wrote you below, i need some maintainer opinion
in which way that responsible person of mm see 'right' implementation.

> The design of having a separate thread is bad. I plan in the future to
> add thread per node support to KSM, and this one odd thread won't
> break things, to which queue should this thread add VMA if there are
> multiple queues?

That will be interesting to look :)
But IMHO:
I think you will need to add some code to ksm_enter().
Because madvise() internally call ksm_enter().

So ksm_enter() will decide which tread must process that.
That not depends on caller.

Thanks.

> Thank you,
> Pasha
>
- - -
1. https://lkml.org/lkml/2014/11/8/206

  reply	other threads:[~2018-11-13 22:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 23:13 Timofey Titovets
2018-11-13  1:49 ` Matthew Wilcox
2018-11-13 11:25   ` Timofey Titovets
2018-11-13  2:25 ` Pavel Tatashin
2018-11-13 11:40   ` Timofey Titovets
2018-11-13 18:42     ` Pavel Tatashin
2018-11-13 22:55       ` Timofey Titovets [this message]
2018-11-13 11:57 ` Jann Horn
2018-11-13 12:58   ` Timofey Titovets
2018-11-13 13:25     ` Jann Horn
     [not found] <<20181112231344.7161-1-timofey.titovets@synesis.ru>
2018-11-13 11:06 ` Oleksandr Natalenko
2018-11-13 11:56   ` Timofey Titovets
2018-11-13 16:33 ` Oleksandr Natalenko
2018-11-13 17:10   ` Timofey Titovets
2018-11-13 17:27     ` Oleksandr Natalenko
2018-11-13 17:44       ` Timofey Titovets
     [not found] <<CAG48ez0ZprqUYGZFxcrY6U3Dnwt77q1NJXzzpsn1XNkRuXVppw@mail.gmail.com>
2018-11-13 14:23 ` Oleksandr Natalenko
2018-11-13 17:59   ` Pavel Tatashin
2018-11-13 18:17     ` Timofey Titovets
2018-11-13 18:35       ` Pavel Tatashin
2018-11-13 18:54         ` Timofey Titovets
2018-11-13 19:16           ` Pavel Tatashin
2018-11-13 22:40             ` Timofey Titovets
2018-11-13 22:53               ` Pavel Tatashin
2018-11-13 23:07                 ` Timofey Titovets
2018-11-13 20:26     ` Jann Horn
2018-11-13 22:35       ` Pavel Tatashin
2018-11-13 18:20 Timofey Titovets

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='CAGqmi74uqeqxD4n=pb=3v48sSfk-pQhk7eTHkuTLxegFAq-D9A@mail.gmail.com' \
    --to=timofey.titovets@synesis.ru \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox