From: Will Deacon <will.deacon@arm.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, Minchan Kim <minchan@kernel.org>,
Andrea Argangeli <andrea@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org, Michal Hocko <mhocko@suse.com>
Subject: Re: [RFC PATCH] arch, mm: introduce arch_tlb_gather_mmu_exit
Date: Tue, 28 Nov 2017 19:00:01 +0000 [thread overview]
Message-ID: <20171128190001.GD8187@arm.com> (raw)
In-Reply-To: <20171123090236.18574-1-mhocko@kernel.org>
On Thu, Nov 23, 2017 at 10:02:36AM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
>
> 5a7862e83000 ("arm64: tlbflush: avoid flushing when fullmm == 1") has
> introduced an optimization to not flush tlb when we are tearing the
> whole address space down. Will goes on to explain
>
> : Basically, we tag each address space with an ASID (PCID on x86) which
> : is resident in the TLB. This means we can elide TLB invalidation when
> : pulling down a full mm because we won't ever assign that ASID to
> : another mm without doing TLB invalidation elsewhere (which actually
> : just nukes the whole TLB).
>
> This all is nice but tlb_gather users are not aware of that and this can
> actually cause some real problems. E.g. the oom_reaper tries to reap the
> whole address space but it might race with threads accessing the memory [1].
> It is possible that soft-dirty handling might suffer from the same
> problem [2] as soon as it starts supporting the feature.
>
> Introduce an explicit exit variant tlb_gather_mmu_exit which allows the
> behavior arm64 implements for the fullmm case and replace it by an
> explicit exit flag in the mmu_gather structure. exit_mmap path is then
> turned into the explicit exit variant. Other architectures simply ignore
> the flag.
>
> [1] http://lkml.kernel.org/r/20171106033651.172368-1-wangnan0@huawei.com
> [2] http://lkml.kernel.org/r/20171110001933.GA12421@bbox
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> I am sending this as an RFC because I am not fully familiar with the tlb
> gather arch implications, espacially the semantic of fullmm. Therefore
> I might duplicate some of its functionality. I hope people on the CC
> list will help me to sort this out.
>
> Comments? Objections?
I can't think of a case where we'd have exit set but not be doing the
fullmm, in which case I'd be inclined to remove the last two parameters
from tlb_gather_mmu_exit.
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, Minchan Kim <minchan@kernel.org>,
Andrea Argangeli <andrea@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-arch@vger.kernel.org, Michal Hocko <mhocko@suse.com>
Subject: Re: [RFC PATCH] arch, mm: introduce arch_tlb_gather_mmu_exit
Date: Tue, 28 Nov 2017 19:00:01 +0000 [thread overview]
Message-ID: <20171128190001.GD8187@arm.com> (raw)
In-Reply-To: <20171123090236.18574-1-mhocko@kernel.org>
On Thu, Nov 23, 2017 at 10:02:36AM +0100, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
>
> 5a7862e83000 ("arm64: tlbflush: avoid flushing when fullmm == 1") has
> introduced an optimization to not flush tlb when we are tearing the
> whole address space down. Will goes on to explain
>
> : Basically, we tag each address space with an ASID (PCID on x86) which
> : is resident in the TLB. This means we can elide TLB invalidation when
> : pulling down a full mm because we won't ever assign that ASID to
> : another mm without doing TLB invalidation elsewhere (which actually
> : just nukes the whole TLB).
>
> This all is nice but tlb_gather users are not aware of that and this can
> actually cause some real problems. E.g. the oom_reaper tries to reap the
> whole address space but it might race with threads accessing the memory [1].
> It is possible that soft-dirty handling might suffer from the same
> problem [2] as soon as it starts supporting the feature.
>
> Introduce an explicit exit variant tlb_gather_mmu_exit which allows the
> behavior arm64 implements for the fullmm case and replace it by an
> explicit exit flag in the mmu_gather structure. exit_mmap path is then
> turned into the explicit exit variant. Other architectures simply ignore
> the flag.
>
> [1] http://lkml.kernel.org/r/20171106033651.172368-1-wangnan0@huawei.com
> [2] http://lkml.kernel.org/r/20171110001933.GA12421@bbox
> Signed-off-by: Michal Hocko <mhocko@suse.com>
> ---
> Hi,
> I am sending this as an RFC because I am not fully familiar with the tlb
> gather arch implications, espacially the semantic of fullmm. Therefore
> I might duplicate some of its functionality. I hope people on the CC
> list will help me to sort this out.
>
> Comments? Objections?
I can't think of a case where we'd have exit set but not be doing the
fullmm, in which case I'd be inclined to remove the last two parameters
from tlb_gather_mmu_exit.
Will
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2017-11-28 18:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-23 9:02 [RFC PATCH] arch, mm: introduce arch_tlb_gather_mmu_exit Michal Hocko
2017-11-23 9:02 ` Michal Hocko
2017-11-23 9:02 ` Michal Hocko
2017-11-28 19:00 ` Will Deacon [this message]
2017-11-28 19:00 ` Will Deacon
2017-11-29 7:22 ` Michal Hocko
2017-11-29 7:22 ` Michal Hocko
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=20171128190001.GD8187@arm.com \
--to=will.deacon@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andrea@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=mingo@redhat.com \
--cc=torvalds@linux-foundation.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.