linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: mpe@ellerman.id.au, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 4/4] powerpc/mm/radix: Implement tlb mmu gather flush efficiently
Date: Thu, 2 Jun 2016 13:12:50 -0700	[thread overview]
Message-ID: <20160602131250.e4d43401e7eade277bc4476a@linux-foundation.org> (raw)
In-Reply-To: <1464860389-29019-4-git-send-email-aneesh.kumar@linux.vnet.ibm.com>

On Thu,  2 Jun 2016 15:09:49 +0530 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> wrote:

> Now that we track page size in mmu_gather, we can use address based
> tlbie format when doing a tlb_flush(). We don't do this if we are
> invalidating the full address space.
> 
> ...
>
>  void radix__tlb_flush(struct mmu_gather *tlb)
>  {
> +	int psize = 0;
>  	struct mm_struct *mm = tlb->mm;
> -	radix__flush_tlb_mm(mm);
> +	int page_size = tlb->page_size;
> +
> +	psize = radix_get_mmu_psize(page_size);
> +	if (psize == -1)
> +		/* unknown page size */
> +		goto flush_mm;
> +
> +	if (!tlb->fullmm && !tlb->need_flush_all)
> +		radix__flush_tlb_range_psize(mm, tlb->start, tlb->end, psize);
> +	else
> +flush_mm:
> +		radix__flush_tlb_mm(mm);

That's kinda ugly.  What about

void radix__tlb_flush(struct mmu_gather *tlb)
{
	int psize = 0;
	struct mm_struct *mm = tlb->mm;
	int page_size = tlb->page_size;

	psize = radix_get_mmu_psize(page_size);

	if (psize != -1 && !tlb->fullmm && !tlb->need_flush_all)
		radix__flush_tlb_range_psize(mm, tlb->start, tlb->end, psize);
	else
		radix__flush_tlb_mm(mm);
}

?

We lost the comment, but that can be neatly addressed by documenting
radix_get_mmu_psize() (of course!).  Please send along a comment to do
this and I'll add it in.

--- a/arch/powerpc/mm/tlb-radix.c~powerpc-mm-radix-implement-tlb-mmu-gather-flush-efficiently-fix
+++ a/arch/powerpc/mm/tlb-radix.c
@@ -265,13 +265,9 @@ void radix__tlb_flush(struct mmu_gather
 	int page_size = tlb->page_size;
 
 	psize = radix_get_mmu_psize(page_size);
-	if (psize == -1)
-		/* unknown page size */
-		goto flush_mm;
 
-	if (!tlb->fullmm && !tlb->need_flush_all)
+	if (psize != -1 && !tlb->fullmm && !tlb->need_flush_all)
 		radix__flush_tlb_range_psize(mm, tlb->start, tlb->end, psize);
 	else
-flush_mm:
 		radix__flush_tlb_mm(mm);
 }
_

I'll await feedback from the other PPC developers before doing anything
further on this patchset.

hm, no ppc mailing lists were cc'ed.  Regrettable.

--
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>

  reply	other threads:[~2016-06-02 20:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  9:39 [PATCH 1/4] mm/hugetlb: Simplify hugetlb unmap Aneesh Kumar K.V
2016-06-02  9:39 ` [PATCH 2/4] mm: Change the interface for __tlb_remove_page Aneesh Kumar K.V
2016-06-02  9:39 ` [PATCH 3/4] mm/mmu_gather: Track page size with mmu gather and force flush if page size change Aneesh Kumar K.V
2016-06-02  9:39 ` [PATCH 4/4] powerpc/mm/radix: Implement tlb mmu gather flush efficiently Aneesh Kumar K.V
2016-06-02 20:12   ` Andrew Morton [this message]
2016-06-03  2:56     ` Aneesh Kumar K.V

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=20160602131250.e4d43401e7eade277bc4476a@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpe@ellerman.id.au \
    /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