Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1639996

Re: [RFC 04/10] x86/mm: Pass flush_tlb_info to flush_tlb_others() etc

From Nadav Amit <nadav.amit@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC 04/10] x86/mm: Pass flush_tlb_info to flush_tlb_others() etc
Date 2017-05-11 22:10 +0200
Message-ID <tG2zn-2xc-11@gated-at.bofh.it> (permalink)
References <tECxj-3oj-5@gated-at.bofh.it> <tECxj-3oj-5@gated-at.bofh.it> <tECxk-3oj-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> On May 7, 2017, at 5:38 AM, Andy Lutomirski <luto@kernel.org> wrote:
> 
> @@ -243,15 +237,15 @@ static void flush_tlb_func(void *info)
> 		return;
> 	}
> 
> -	if (f->flush_end == TLB_FLUSH_ALL) {
> +	if (f->end == TLB_FLUSH_ALL) {
> 		local_flush_tlb();
> 		trace_tlb_flush(TLB_REMOTE_SHOOTDOWN, TLB_FLUSH_ALL);
> 	} else {
> 		unsigned long addr;
> 		unsigned long nr_pages =
> -			(f->flush_end - f->flush_start) / PAGE_SIZE;
> -		addr = f->flush_start;
> -		while (addr < f->flush_end) {
> +			(f->end - f->start) / PAGE_SIZE;
> +		addr = f->start;
> +		while (addr < f->end) {
> 			__flush_tlb_single(addr);
> 			addr += PAGE_SIZE;
> 		}
> @@ -260,33 +254,27 @@ static void flush_tlb_func(void *info)
> }
> 
> void native_flush_tlb_others(const struct cpumask *cpumask,
> -				 struct mm_struct *mm, unsigned long start,
> -				 unsigned long end)
> +			     const struct flush_tlb_info *info)
> {
> -	struct flush_tlb_info info;
> -
> -	info.flush_mm = mm;
> -	info.flush_start = start;
> -	info.flush_end = end;
> -
> 	count_vm_tlb_event(NR_TLB_REMOTE_FLUSH);
> -	if (end == TLB_FLUSH_ALL)
> +	if (info->end == TLB_FLUSH_ALL)
> 		trace_tlb_flush(TLB_REMOTE_SEND_IPI, TLB_FLUSH_ALL);
> 	else
> 		trace_tlb_flush(TLB_REMOTE_SEND_IPI,
> -				(end - start) >> PAGE_SHIFT);
> +				(info->end - info->start) >> PAGE_SHIFT);

I know it is stupid, but since you already change the code, can you make
flush_tlb_func() and native_flush_tlb_others() consistent in the way
they compute the number of pages? (either ‘>> PAGE_SHIFT’ or ‘/ PAGE_SIZE’)?

On a different topic: I do not like or actually understand why TLBSTATE_OK
is defined as 1 and not 0. The very least it would generate a better code.

Thanks,
Nadav

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 00/10] x86 TLB flush cleanups, moving toward PCID support Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
  [RFC 03/10] x86/mm: Make the batched unmap TLB flush API more generic Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
    Re: [RFC 03/10] x86/mm: Make the batched unmap TLB flush API more  generic Dave Hansen <dave.hansen@intel.com> - 2017-05-08 17:40 +0200
      Re: [RFC 03/10] x86/mm: Make the batched unmap TLB flush API more generic Andy Lutomirski <luto@kernel.org> - 2017-05-09 15:10 +0200
        Re: [RFC 03/10] x86/mm: Make the batched unmap TLB flush API more  generic Mel Gorman <mgorman@suse.de> - 2017-05-09 16:50 +0200
        Re: [RFC 03/10] x86/mm: Make the batched unmap TLB flush API more  generic Dave Hansen <dave.hansen@intel.com> - 2017-05-09 19:20 +0200
          Re: [RFC 03/10] x86/mm: Make the batched unmap TLB flush API more generic Andy Lutomirski <luto@kernel.org> - 2017-05-10 01:00 +0200
  [RFC 07/10] x86/mm: Use new merged flush logic in arch_tlbbatch_flush() Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
  [RFC 04/10] x86/mm: Pass flush_tlb_info to flush_tlb_others() etc Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
    Re: [RFC 04/10] x86/mm: Pass flush_tlb_info to flush_tlb_others() etc Nadav Amit <nadav.amit@gmail.com> - 2017-05-11 22:10 +0200
      Re: [RFC 04/10] x86/mm: Pass flush_tlb_info to flush_tlb_others() etc Andy Lutomirski <luto@kernel.org> - 2017-05-12 05:50 +0200
  [RFC 05/10] x86/mm: Change the leave_mm() condition for local TLB flushes Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
  [RFC 02/10] x86/mm: Reduce indentation in flush_tlb_func() Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
  [RFC 08/10] x86/mm: Remove the UP tlbflush code; always use the formerly SMP code Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
  [RFC 01/10] x86/mm: Reimplement flush_tlb_page() using flush_tlb_mm_range() Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:10 +0200
    Re: [RFC 01/10] x86/mm: Reimplement flush_tlb_page() using  flush_tlb_mm_range() Borislav Petkov <bp@suse.de> - 2017-05-11 19:50 +0200
      Re: [RFC 01/10] x86/mm: Reimplement flush_tlb_page() using flush_tlb_mm_range() Andy Lutomirski <luto@kernel.org> - 2017-05-12 05:40 +0200
  [RFC 10/10] x86,kvm: Teach KVM's VMX code that CR3 isn't a constant Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:20 +0200
  [RFC 06/10] x86/mm: Refactor flush_tlb_mm_range() to merge local and remote cases Andy Lutomirski <luto@kernel.org> - 2017-05-08 00:20 +0200
  Re: [RFC 00/10] x86 TLB flush cleanups, moving toward PCID support Linus Torvalds <torvalds@linux-foundation.org> - 2017-05-08 01:00 +0200
  Re: [RFC 00/10] x86 TLB flush cleanups, moving toward PCID support Ingo Molnar <mingo@kernel.org> - 2017-05-08 01:50 +0200
  Re: [RFC 00/10] x86 TLB flush cleanups, moving toward PCID support Nadav Amit <nadav.amit@gmail.com> - 2017-05-08 18:40 +0200
    Re: [RFC 00/10] x86 TLB flush cleanups, moving toward PCID support Andy Lutomirski <luto@kernel.org> - 2017-05-09 14:50 +0200

csiph-web