linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Song Liu <songliubraving@fb.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux-MM <linux-mm@kvack.org>,
	"oleg@redhat.com" <oleg@redhat.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"mhiramat@kernel.org" <mhiramat@kernel.org>,
	"matthew.wilcox@oracle.com" <matthew.wilcox@oracle.com>,
	"kirill.shutemov@linux.intel.com"
	<kirill.shutemov@linux.intel.com>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v4 5/5] uprobe: collapse THP pmd after removing all uprobes
Date: Mon, 24 Jun 2019 15:34:38 +0300	[thread overview]
Message-ID: <20190624123438.dubsp52tauwkr342@box> (raw)
In-Reply-To: <DB6689FE-8528-4883-8CD9-CFE5F3BEC321@fb.com>

On Fri, Jun 21, 2019 at 06:04:14PM +0000, Song Liu wrote:
> 
> 
> > On Jun 21, 2019, at 9:30 AM, Song Liu <songliubraving@fb.com> wrote:
> > 
> > 
> > 
> >> On Jun 21, 2019, at 6:45 AM, Song Liu <songliubraving@fb.com> wrote:
> >> 
> >> 
> >> 
> >>> On Jun 21, 2019, at 6:36 AM, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> >>> 
> >>> On Fri, Jun 21, 2019 at 01:17:05PM +0000, Song Liu wrote:
> >>>> 
> >>>> 
> >>>>> On Jun 21, 2019, at 5:48 AM, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> >>>>> 
> >>>>> On Thu, Jun 13, 2019 at 10:57:47AM -0700, Song Liu wrote:
> >>>>>> After all uprobes are removed from the huge page (with PTE pgtable), it
> >>>>>> is possible to collapse the pmd and benefit from THP again. This patch
> >>>>>> does the collapse.
> >>>>>> 
> >>>>>> An issue on earlier version was discovered by kbuild test robot.
> >>>>>> 
> >>>>>> Reported-by: kbuild test robot <lkp@intel.com>
> >>>>>> Signed-off-by: Song Liu <songliubraving@fb.com>
> >>>>>> ---
> >>>>>> include/linux/huge_mm.h |  7 +++++
> >>>>>> kernel/events/uprobes.c |  5 ++-
> >>>>>> mm/huge_memory.c        | 69 +++++++++++++++++++++++++++++++++++++++++
> >>>>> 
> >>>>> I still sync it's duplication of khugepaged functinallity. We need to fix
> >>>>> khugepaged to handle SCAN_PAGE_COMPOUND and probably refactor the code to
> >>>>> be able to call for collapse of particular range if we have all locks
> >>>>> taken (as we do in uprobe case).
> >>>>> 
> >>>> 
> >>>> I see the point now. I misunderstood it for a while. 
> >>>> 
> >>>> If we add this to khugepaged, it will have some conflicts with my other 
> >>>> patchset. How about we move the functionality to khugepaged after these
> >>>> two sets get in? 
> >>> 
> >>> Is the last patch of the patchset essential? I think this part can be done
> >>> a bit later in a proper way, no?
> >> 
> >> Technically, we need this patch to regroup pmd mapped page, and thus get 
> >> the performance benefit after the uprobe is detached. 
> >> 
> >> On the other hand, if we get the first 4 patches of the this set and the 
> >> other set in soonish. I will work on improving this patch right after that..
> > 
> > Actually, it might be pretty easy. We can just call try_collapse_huge_pmd() 
> > in khugepaged.c (in khugepaged_scan_shmem() or khugepaged_scan_file() after 
> > my other set). 
> > 
> > Let me fold that in and send v5. 
> 
> On a second thought, if we would have khugepaged to do collapse, we need a
> dedicated bit to tell khugepaged which pmd to collapse. Otherwise, it may 
> accidentally collapse pmd that are split by other split_huge_pmd. 

Why is it a problem? Do you know a situation where such collapse possible
and will break split_huge_pmd() user's expectation. If there's such user
it is broken: normal locking should prevent such situation.

-- 
 Kirill A. Shutemov

  reply	other threads:[~2019-06-24 12:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 17:57 [PATCH v4 0/5] THP aware uprobe Song Liu
2019-06-13 17:57 ` [PATCH v4 1/5] mm: move memcmp_pages() and pages_identical() Song Liu
2019-06-13 17:57 ` [PATCH v4 2/5] uprobe: use original page when all uprobes are removed Song Liu
2019-06-13 17:57 ` [PATCH v4 3/5] mm, thp: introduce FOLL_SPLIT_PMD Song Liu
2019-06-21 12:44   ` Kirill A. Shutemov
2019-06-21 14:08     ` Song Liu
2019-06-13 17:57 ` [PATCH v4 4/5] uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT Song Liu
2019-06-13 17:57 ` [PATCH v4 5/5] uprobe: collapse THP pmd after removing all uprobes Song Liu
2019-06-21 12:48   ` Kirill A. Shutemov
2019-06-21 13:17     ` Song Liu
2019-06-21 13:36       ` Kirill A. Shutemov
2019-06-21 13:45         ` Song Liu
2019-06-21 16:30           ` Song Liu
2019-06-21 18:04             ` Song Liu
2019-06-24 12:34               ` Kirill A. Shutemov [this message]
2019-06-24 13:53                 ` Song Liu
2019-06-17  4:27 ` [PATCH v4 0/5] THP aware uprobe Song Liu

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=20190624123438.dubsp52tauwkr342@box \
    --to=kirill@shutemov.name \
    --cc=Kernel-team@fb.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=matthew.wilcox@oracle.com \
    --cc=mhiramat@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.com \
    /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;
as well as URLs for NNTP newsgroup(s).