All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Tatashin <pasha.tatashin@soleen.com>
To: Timofey Titovets <timofey.titovets@synesis.ru>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Matthew Wilcox <willy@infradead.org>,
	linux-mm <linux-mm@kvack.org>,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH V3] KSM: allow dedup all tasks memory
Date: Tue, 13 Nov 2018 10:42:47 -0800	[thread overview]
Message-ID: <CA+CK2bB0C-PCdaHS7YiLf5iZWn1bATg2y32ogL1FSw7LY9E7SQ@mail.gmail.com> (raw)
In-Reply-To: <CAGqmi744_8NA30V0aWCpFi_=WSaA+18h3njOTQG0SFUVdXi8bg@mail.gmail.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.

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?

Thank you,
Pasha

  reply	other threads:[~2018-11-13 18:43 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 23:13 [PATCH V3] KSM: allow dedup all tasks memory 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 [this message]
2018-11-13 22:55       ` Timofey Titovets
2018-11-13 11:57 ` Jann Horn
2018-11-13 12:58   ` Timofey Titovets
2018-11-13 13:25     ` Jann Horn
     [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:35         ` Pavel Tatashin
2018-11-13 18:54         ` Timofey Titovets
2018-11-13 19:16           ` Pavel Tatashin
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
     [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 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
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=CA+CK2bB0C-PCdaHS7YiLf5iZWn1bATg2y32ogL1FSw7LY9E7SQ@mail.gmail.com \
    --to=pasha.tatashin@soleen.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=timofey.titovets@synesis.ru \
    --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 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.