diff mbox

arm64: export __cpu_{clear,copy}_user_page functions

Message ID 1403025266-2326-1-git-send-email-msalter@redhat.com
State Accepted
Commit bec7cedc8a92bfe96d32febe72634b30c63896bd
Headers show

Commit Message

Mark Salter June 17, 2014, 5:14 p.m. UTC
The __cpu_clear_user_page() and __cpu_copy_user_page() functions
are not currently exported. This prevents modules from using
clear_user_page() and opy_user_page().

Signed-off-by: Mark Salter <msalter@redhat.com>
---
 arch/arm64/mm/copypage.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Catalin Marinas June 18, 2014, 10:39 a.m. UTC | #1
On Tue, Jun 17, 2014 at 06:14:26PM +0100, Mark Salter wrote:
> The __cpu_clear_user_page() and __cpu_copy_user_page() functions
> are not currently exported. This prevents modules from using
> clear_user_page() and opy_user_page().
> 
> Signed-off-by: Mark Salter <msalter@redhat.com>
> ---
>  arch/arm64/mm/copypage.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c
> index 9aecbac..13bbc3be 100644
> --- a/arch/arm64/mm/copypage.c
> +++ b/arch/arm64/mm/copypage.c
> @@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
>  	copy_page(kto, kfrom);
>  	__flush_dcache_area(kto, PAGE_SIZE);
>  }
> +EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
>  
>  void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
>  {
>  	clear_page(kaddr);
>  }
> +EXPORT_SYMBOL_GPL(__cpu_clear_user_page);

I wonder why we still have these functions. I don't think we need any
D-cache flushing for copy_user_page(), so we could simply remove this
code and define copy_user_page() as copy_page() (similarly for
clear_user_page). I'll post a patch separately removing the copy_page,
copy_user_page etc. functions (now that we also have optimised memcpy
and memset).
Mark Salter June 18, 2014, 1:54 p.m. UTC | #2
On Wed, 2014-06-18 at 11:39 +0100, Catalin Marinas wrote:
> On Tue, Jun 17, 2014 at 06:14:26PM +0100, Mark Salter wrote:
> > The __cpu_clear_user_page() and __cpu_copy_user_page() functions
> > are not currently exported. This prevents modules from using
> > clear_user_page() and opy_user_page().
> > 
> > Signed-off-by: Mark Salter <msalter@redhat.com>
> > ---
> >  arch/arm64/mm/copypage.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c
> > index 9aecbac..13bbc3be 100644
> > --- a/arch/arm64/mm/copypage.c
> > +++ b/arch/arm64/mm/copypage.c
> > @@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
> >  	copy_page(kto, kfrom);
> >  	__flush_dcache_area(kto, PAGE_SIZE);
> >  }
> > +EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
> >  
> >  void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
> >  {
> >  	clear_page(kaddr);
> >  }
> > +EXPORT_SYMBOL_GPL(__cpu_clear_user_page);
> 
> I wonder why we still have these functions. I don't think we need any
> D-cache flushing for copy_user_page(), so we could simply remove this
> code and define copy_user_page() as copy_page() (similarly for
> clear_user_page). I'll post a patch separately removing the copy_page,
> copy_user_page etc. functions (now that we also have optimised memcpy
> and memset).
> 

Even better. I much prefer removing code than adding it. Thanks.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Catalin Marinas June 23, 2014, 11:31 a.m. UTC | #3
On Wed, Jun 18, 2014 at 02:54:03PM +0100, Mark Salter wrote:
> On Wed, 2014-06-18 at 11:39 +0100, Catalin Marinas wrote:
> > On Tue, Jun 17, 2014 at 06:14:26PM +0100, Mark Salter wrote:
> > > The __cpu_clear_user_page() and __cpu_copy_user_page() functions
> > > are not currently exported. This prevents modules from using
> > > clear_user_page() and opy_user_page().
> > > 
> > > Signed-off-by: Mark Salter <msalter@redhat.com>
> > > ---
> > >  arch/arm64/mm/copypage.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c
> > > index 9aecbac..13bbc3be 100644
> > > --- a/arch/arm64/mm/copypage.c
> > > +++ b/arch/arm64/mm/copypage.c
> > > @@ -27,8 +27,10 @@ void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
> > >  	copy_page(kto, kfrom);
> > >  	__flush_dcache_area(kto, PAGE_SIZE);
> > >  }
> > > +EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
> > >  
> > >  void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
> > >  {
> > >  	clear_page(kaddr);
> > >  }
> > > +EXPORT_SYMBOL_GPL(__cpu_clear_user_page);
> > 
> > I wonder why we still have these functions. I don't think we need any
> > D-cache flushing for copy_user_page(), so we could simply remove this
> > code and define copy_user_page() as copy_page() (similarly for
> > clear_user_page). I'll post a patch separately removing the copy_page,
> > copy_user_page etc. functions (now that we also have optimised memcpy
> > and memset).
> 
> Even better. I much prefer removing code than adding it. Thanks.

For the time being I'll merge your patch since using memset for
clear_page adds a small overhead with checking the alignment and the
fill value (not much but consistently slower in my mmap benchmarks).
diff mbox

Patch

diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c
index 9aecbac..13bbc3be 100644
--- a/arch/arm64/mm/copypage.c
+++ b/arch/arm64/mm/copypage.c
@@ -27,8 +27,10 @@  void __cpu_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr)
 	copy_page(kto, kfrom);
 	__flush_dcache_area(kto, PAGE_SIZE);
 }
+EXPORT_SYMBOL_GPL(__cpu_copy_user_page);
 
 void __cpu_clear_user_page(void *kaddr, unsigned long vaddr)
 {
 	clear_page(kaddr);
 }
+EXPORT_SYMBOL_GPL(__cpu_clear_user_page);