Re: [PATCH v3 4/4] fs/sysv: Replace kmap() with kmap_local_page()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 20, 2023 at 04:45:17AM +0000, Al Viro wrote:
> On Fri, Jan 20, 2023 at 04:28:12AM +0000, Matthew Wilcox wrote:
> > On Fri, Jan 20, 2023 at 04:21:06AM +0000, Al Viro wrote:
> > > On Thu, Jan 19, 2023 at 04:32:32PM +0100, Fabio M. De Francesco wrote:
> > > 
> > > > -inline void dir_put_page(struct page *page)
> > > > +inline void dir_put_page(struct page *page, void *page_addr)
> > > >  {
> > > > -	kunmap(page);
> > > > +	kunmap_local(page_addr);
> > > 
> > > ... and that needed to be fixed - at some point "round down to beginning of
> > > page" got lost in rebasing...
> > 
> > You don't need to round down in kunmap().  See:
> > 
> > void kunmap_local_indexed(const void *vaddr)
> > {
> >         unsigned long addr = (unsigned long) vaddr & PAGE_MASK;
> > 
> 
> Sure, but... there's also this:
> 
> static inline void __kunmap_local(const void *addr)
> {
> #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
>         kunmap_flush_on_unmap(addr);
> #endif
> }
> 
> Are you sure that the guts of that thing will be happy with address that is not
> page-aligned?  I've looked there at some point, got scared of parisc (IIRC)
> MMU details and decided not to rely upon that...

Ugh, PA-RISC (the only implementor) definitely will flush the wrong
addresses.  I think we should do this, as having bugs that only manifest
on one not-well-tested architecture seems Bad.

 static inline void __kunmap_local(const void *addr)
 {
 #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
-       kunmap_flush_on_unmap(addr);
+       kunmap_flush_on_unmap(PAGE_ALIGN_DOWN(addr));
 #endif
 }

Thoughts?



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux