From: Rik van Riel <riel@surriel.com>
To: Andy Lutomirski <luto@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
kernel-team <kernel-team@fb.com>, X86 ML <x86@kernel.org>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Ingo Molnar <mingo@kernel.org>, Mike Galbraith <efault@gmx.de>,
Dave Hansen <dave.hansen@intel.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH v2 11/11] mm,sched: conditionally skip lazy TLB mm refcounting
Date: Mon, 30 Jul 2018 17:46:10 -0400 [thread overview]
Message-ID: <1532987170.28585.52.camel@surriel.com> (raw)
In-Reply-To: <CALCETrXnG9nPzJKOtd=65BWeoTs2y=mVUAEvNGmFrD8fvg-EfQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3174 bytes --]
On Mon, 2018-07-30 at 12:49 -0700, Andy Lutomirski wrote:
>
> I think it's a big step in the right direction, but it still makes be
> nervous. I'd be more comfortable with it if you at least had a
> functional set of patches that result in active_mm being gone,
> because
> that will mean that you actually audited the whole mess and fixed
> anything that might rely on active_mm pointing somewhere or that
> might
> be putting a value you didn't take into account into active_mm. IOW
> I'm not totally thrilled by applying the patches as is if we're still
> a bit unsure as to what might have gotten missed.
>
> I don't think it's at all necessary to redo the patches.
>
> Does that seem reasonable?
Absolutely. I tried to keep ->active_mm very similar
to before for exactly that reason.
Lets go through all the places where it is used, in
x86 and architecture independent code. I have not
checked other architectures.
It looks like we should be able to get rid of
->active_mm at some point, but a lot of it depends
on other architecture maintainers.
arch/x86/events/core.c:
- get_segment_base: get current->active_mm->context.ldt,
this appears to be for TIF_IA32 user programs only, so
we should be able to use current->mm here
arch/x86/kernel/cpu/common.c:
- current task's ->active_mm assigned in two places,
never read
arch/x86/lib/insn-eval.c:
- get_desc() gets current->active_mm->context.ldt, this
appears to be only for user space programs
arch/x86/mm/tlb.c:
- this series adds two places where current->active_mm is
written, it is never read
arch/x86/platform/efi/efi_64.c:
- current->active_mm is set to efi_mm for a little bit,
with irqs disabled, and then changed back, with irqs still
disabled; we should be able to get rid of ->active_mm here
- in the init code, ->active_mm is set to efi_mm as well,
presumably the kernel automatically switches that back on
the next context switch; this may be buggy, since preemption
is enabled and a GFP_KERNEL allocation is just a few lines
below
arch/x86/power/cpu.c:
- fix_processor_context() calls load_mm_ldt(current->active_mm);,
we should be able to use cpu_tlbstate.loaded_mm instead
drivers/cpufreq/pmac32-cpufreq.c:
- pmu_set_cpu_speed() restores current->active_mm - don't know if
anyone still cares about 32 bit PPC :)
drivers/firmware/efi/arm-runtime.c:
- efi_virtmap_unload switches back the pgd to current->active_mm
from &efi_mm; that mm could be stored elsewhere if we excised
->active_mm everywhere
drivers/macintosh/via-pmu.c:
- same deal as pmap32-cpufreq.c above
mm/mmu_context.c:
- use_mm() tracks the ->active_mm a kernel thread is pointing to,
but the mm is also tracked in ->mm
- unuse_mm() is the same deal as use_mm(), we should be able to
get rid of ->active_mm if everybody stops using it, and we
no longer refcount it anywhere
init/init_task.c:
- init_task.active_mm = &init_mm
fs/exec.c:
- exec_mmap() juggles both ->mm and ->active_mm, in order to
get refcounting right; without refcounting we can lose ->active_mm
--
All Rights Reversed.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2018-07-30 21:46 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-28 21:53 [PATCH 0/10] x86,tlb,mm: more lazy TLB cleanups & optimizations Rik van Riel
2018-07-28 21:53 ` [PATCH 01/10] x86,tlb: clarify memory barrier in switch_mm_irqs_off Rik van Riel
2018-07-29 2:59 ` Andy Lutomirski
2018-07-28 21:53 ` [PATCH 02/10] smp: use __cpumask_set_cpu in on_each_cpu_cond Rik van Riel
2018-07-29 2:59 ` Andy Lutomirski
2018-07-28 21:53 ` [PATCH 03/10] smp,cpumask: introduce on_each_cpu_cond_mask Rik van Riel
2018-07-29 2:57 ` Andy Lutomirski
2018-07-29 12:00 ` Rik van Riel
[not found] ` <E710FBA5-CC5E-4941-ACBF-4AB3424F1F68@amacapital.net>
2018-07-29 17:39 ` Rik van Riel
2018-07-29 17:51 ` Rik van Riel
2018-07-29 18:55 ` Andy Lutomirski
2018-07-29 19:56 ` Linus Torvalds
2018-07-28 21:53 ` [PATCH 04/10] x86,mm: use on_each_cpu_cond for TLB flushes Rik van Riel
2018-07-29 2:58 ` Andy Lutomirski
2018-07-29 12:02 ` Rik van Riel
2018-07-28 21:53 ` [PATCH 05/10] mm,tlb: turn dummy defines into inline functions Rik van Riel
2018-07-28 21:53 ` [PATCH 06/10] mm,x86: skip cr4 and ldt reload when mm stays the same Rik van Riel
2018-07-29 4:21 ` Andy Lutomirski
2018-07-28 21:53 ` [PATCH 07/10] x86,mm: remove leave_mm cpu argument Rik van Riel
2018-07-28 21:53 ` [PATCH 08/10] arch,mm: add config variable to skip lazy TLB mm refcounting Rik van Riel
2018-07-28 21:53 ` [PATCH 09/10] mm,x86: shoot down lazy TLB references at exit_mmap time Rik van Riel
2018-07-28 21:53 ` [PATCH 10/10] mm,sched: conditionally skip lazy TLB mm refcounting Rik van Riel
2018-07-29 4:21 ` Andy Lutomirski
2018-07-29 12:11 ` Rik van Riel
2018-07-29 15:29 ` Andy Lutomirski
2018-07-29 16:55 ` Rik van Riel
2018-07-29 19:54 ` [PATCH v2 10/11] x86,tlb: really leave mm on shootdown Rik van Riel
2018-07-29 19:54 ` [PATCH v2 11/11] mm,sched: conditionally skip lazy TLB mm refcounting Rik van Riel
2018-07-30 9:55 ` Peter Zijlstra
2018-07-30 14:30 ` Rik van Riel
2018-07-30 16:26 ` Peter Zijlstra
2018-07-30 19:15 ` Rik van Riel
2018-07-30 19:30 ` Andy Lutomirski
2018-07-30 19:36 ` Rik van Riel
2018-07-30 19:49 ` Andy Lutomirski
2018-07-30 21:46 ` Rik van Riel [this message]
2018-07-30 22:00 ` Andy Lutomirski
2018-07-31 1:05 ` Rik van Riel
2018-07-31 9:12 ` Peter Zijlstra
2018-07-31 14:29 ` Andy Lutomirski
2018-07-31 15:03 ` Rik van Riel
2018-07-31 15:12 ` Peter Zijlstra
2018-07-30 11:32 ` [PATCH 0/10] x86,tlb,mm: more lazy TLB cleanups & optimizations Ingo Molnar
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=1532987170.28585.52.camel@surriel.com \
--to=riel@surriel.com \
--cc=benh@kernel.crashing.org \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@intel.com \
--cc=efault@gmx.de \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=vkuznets@redhat.com \
--cc=x86@kernel.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