All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: avoid cache flushing in flush_dcache_page()
@ 2016-11-07 10:30 Rabin Vincent
  2016-11-07 11:35 ` Catalin Marinas
  0 siblings, 1 reply; 4+ messages in thread
From: Rabin Vincent @ 2016-11-07 10:30 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rabin Vincent <rabinv@axis.com>

When the data cache is PIPT or VIPT non-aliasing, and cache operations
are broadcast by the hardware, we can always postpone the flush in
flush_dcache_page().  A similar change was done for ARM64 in commit
b5b6c9e9149d ("arm64: Avoid cache flushing in flush_dcache_page()").

Signed-off-by: Rabin Vincent <rabinv@axis.com>
---
 arch/arm/mm/flush.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 3cced84..f1e6190 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -327,6 +327,12 @@ void flush_dcache_page(struct page *page)
 	if (page == ZERO_PAGE(0))
 		return;
 
+	if (!cache_ops_need_broadcast() && cache_is_vipt_nonaliasing()) {
+		if (test_bit(PG_dcache_clean, &page->flags))
+			clear_bit(PG_dcache_clean, &page->flags);
+		return;
+	}
+
 	mapping = page_mapping(page);
 
 	if (!cache_ops_need_broadcast() &&
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] ARM: avoid cache flushing in flush_dcache_page()
  2016-11-07 10:30 [PATCH] ARM: avoid cache flushing in flush_dcache_page() Rabin Vincent
@ 2016-11-07 11:35 ` Catalin Marinas
  2016-11-07 11:48   ` Russell King - ARM Linux
  0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2016-11-07 11:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 07, 2016 at 11:30:24AM +0100, Rabin Vincent wrote:
> diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
> index 3cced84..f1e6190 100644
> --- a/arch/arm/mm/flush.c
> +++ b/arch/arm/mm/flush.c
> @@ -327,6 +327,12 @@ void flush_dcache_page(struct page *page)
>  	if (page == ZERO_PAGE(0))
>  		return;
>  
> +	if (!cache_ops_need_broadcast() && cache_is_vipt_nonaliasing()) {
> +		if (test_bit(PG_dcache_clean, &page->flags))
> +			clear_bit(PG_dcache_clean, &page->flags);
> +		return;
> +	}
> +
>  	mapping = page_mapping(page);
>  
>  	if (!cache_ops_need_broadcast() &&

I'm ok with the logic in this patch but is there a way to combine the
two 'if' blocks together, just to keep the function shorter?

-- 
Catalin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ARM: avoid cache flushing in flush_dcache_page()
  2016-11-07 11:35 ` Catalin Marinas
@ 2016-11-07 11:48   ` Russell King - ARM Linux
  2016-11-07 12:00     ` Catalin Marinas
  0 siblings, 1 reply; 4+ messages in thread
From: Russell King - ARM Linux @ 2016-11-07 11:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 07, 2016 at 11:35:27AM +0000, Catalin Marinas wrote:
> On Mon, Nov 07, 2016 at 11:30:24AM +0100, Rabin Vincent wrote:
> > diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
> > index 3cced84..f1e6190 100644
> > --- a/arch/arm/mm/flush.c
> > +++ b/arch/arm/mm/flush.c
> > @@ -327,6 +327,12 @@ void flush_dcache_page(struct page *page)
> >  	if (page == ZERO_PAGE(0))
> >  		return;
> >  
> > +	if (!cache_ops_need_broadcast() && cache_is_vipt_nonaliasing()) {
> > +		if (test_bit(PG_dcache_clean, &page->flags))
> > +			clear_bit(PG_dcache_clean, &page->flags);
> > +		return;
> > +	}
> > +
> >  	mapping = page_mapping(page);
> >  
> >  	if (!cache_ops_need_broadcast() &&
> 
> I'm ok with the logic in this patch but is there a way to combine the
> two 'if' blocks together, just to keep the function shorter?

Probably not without reducing code readability, or moving
page_mapping() before this new if() block (which may introduce
extra code into the path.)

As this path gets used for filesystem read/write, it would be a
good idea to keep it as efficient as possible.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ARM: avoid cache flushing in flush_dcache_page()
  2016-11-07 11:48   ` Russell King - ARM Linux
@ 2016-11-07 12:00     ` Catalin Marinas
  0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2016-11-07 12:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Nov 07, 2016 at 11:48:45AM +0000, Russell King - ARM Linux wrote:
> On Mon, Nov 07, 2016 at 11:35:27AM +0000, Catalin Marinas wrote:
> > On Mon, Nov 07, 2016 at 11:30:24AM +0100, Rabin Vincent wrote:
> > > diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
> > > index 3cced84..f1e6190 100644
> > > --- a/arch/arm/mm/flush.c
> > > +++ b/arch/arm/mm/flush.c
> > > @@ -327,6 +327,12 @@ void flush_dcache_page(struct page *page)
> > >  	if (page == ZERO_PAGE(0))
> > >  		return;
> > >  
> > > +	if (!cache_ops_need_broadcast() && cache_is_vipt_nonaliasing()) {
> > > +		if (test_bit(PG_dcache_clean, &page->flags))
> > > +			clear_bit(PG_dcache_clean, &page->flags);
> > > +		return;
> > > +	}
> > > +
> > >  	mapping = page_mapping(page);
> > >  
> > >  	if (!cache_ops_need_broadcast() &&
> > 
> > I'm ok with the logic in this patch but is there a way to combine the
> > two 'if' blocks together, just to keep the function shorter?
> 
> Probably not without reducing code readability, or moving
> page_mapping() before this new if() block (which may introduce
> extra code into the path.)

You are right, we would need 'mapping' in the subsequent checks, so I
don't think the code would be more readable if we are to keep it
efficient. In this case:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-07 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-07 10:30 [PATCH] ARM: avoid cache flushing in flush_dcache_page() Rabin Vincent
2016-11-07 11:35 ` Catalin Marinas
2016-11-07 11:48   ` Russell King - ARM Linux
2016-11-07 12:00     ` Catalin Marinas

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.