Re: O_DIRECT patch for processors with VIPT cache for mainline kernel (specifically arm in our case)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ralf Baechle
Date: Thursday, November 20, 2008 - 10:17 am

On Thu, Nov 20, 2008 at 08:27:19AM -0700, Matthew Wilcox wrote:


Even if we know the userspace address of a page we do not necessarily have
a usable mapping for kernel purposes.  The userspace mapping might be r/o
when we need r/w or it might be in another process.  kmap_coherent takes
the job of creating a r/w mapping on a suitable kernel virtual address
that will avoid any aliases.


Having all userspace addresses of a page across all processes coherent with
each other is the only practicable solution in Linux; at least I don't think
how otherwise and within the currently kernel framework a platform could
sanely handle userspace-userspace aliases.  So we're talking about extending
this to cover userspace-kernelspace aliases.

The original reason for the introduction of kmap_coherent was avoiding
a cache alias in when a multi-threaded process forks.  The issue has been
debated on lkml in 2006 as part of my submission of a patchset under the
subject of "Fix COW D-cache aliasing on fork".  The description is somewhat
lengthy so I omit it here.

One of the ugly parts of kmap_coherent() is that it cannot be used safely
if the page has been marked as dirty by flush_dcache_page(); the callers
know about this and deal with it.


The speedup is no surprise.

  Ralf
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Wed Nov 19, 1:43 pm)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Thu Nov 20, 2:19 am)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Thu Nov 20, 9:30 am)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Ralf Baechle, (Thu Nov 20, 10:17 am)
Re: O_DIRECT patch for processors with VIPT cache for main ..., Russell King - ARM Linux, (Thu Nov 20, 12:30 pm)