mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: riel@surriel.com
Subject: question on lazy tlb flush
Date: Wed, 29 May 2019 12:54:57 +0800	[thread overview]
Message-ID: <cd421c2c-8507-6652-2ef7-a6f3b20efcd2@oracle.com> (raw)

Hi Maintainers,

A question raised when I learned below code.  Appreciate any help me 
understand the code.

void native_flush_tlb_others(const struct cpumask *cpumask,
                              const struct flush_tlb_info *info)

{

...

         /*
          * If no page tables were freed, we can skip sending IPIs to
          * CPUs in lazy TLB mode. They will flush the CPU themselves
          * at the next context switch.
          *
          * However, if page tables are getting freed, we need to send the
          * IPI everywhere, to prevent CPUs in lazy TLB mode from tripping
          * up on the new contents of what used to be page tables, while
          * doing a speculative memory access.
          */
         if (info->freed_tables)
                 smp_call_function_many(cpumask, flush_tlb_func_remote,
                                (void *)info, 1);
         else
                 on_each_cpu_cond_mask(tlb_is_not_lazy, 
flush_tlb_func_remote,
                                 (void *)info, 1, GFP_ATOMIC, cpumask);

}

I just didn't understand how a kernel thread could trip up on the new 
contents of what used to be page tables. I presume the freed page tables 
are user mapping?

But kernel thread only access kernel address space, is kernel space also 
freed?


thanks

Zhenzhong


             reply	other threads:[~2019-05-29  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29  4:54 Zhenzhong Duan [this message]
2019-05-29 14:17 ` Rik van Riel
2019-05-30  2:09   ` Zhenzhong Duan

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=cd421c2c-8507-6652-2ef7-a6f3b20efcd2@oracle.com \
    --to=zhenzhong.duan@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@surriel.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

all inboxes | Powered by JetHome®