Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-24 Thread Matt Mackall
On Thu, 2008-01-24 at 12:36 +1100, Nick Piggin wrote: > On Thursday 24 January 2008 04:05, Linus Torvalds wrote: > > On Wed, 23 Jan 2008, Anton Salikhmetov wrote: > > > + > > > + if (pte_dirty(*pte) && pte_write(*pte)) { > > > > Not correct. > > > > You still need to check "pte_present()"

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Nick Piggin
On Thursday 24 January 2008 04:05, Linus Torvalds wrote: > On Wed, 23 Jan 2008, Anton Salikhmetov wrote: > > + > > + if (pte_dirty(*pte) && pte_write(*pte)) { > > Not correct. > > You still need to check "pte_present()" before you can test any other > bits. For a non-present pte, none of

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Hugh Dickins
On Wed, 23 Jan 2008, Linus Torvalds wrote: > > So we certainly *could* make ramfs/tmpfs claim they do dirty accounting, > but just having a no-op writeback. Without that, they'd need something > really special in the file time updates. What we might reasonably choose to end up doing there (in 2

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Linus Torvalds
On Thu, 24 Jan 2008, Miklos Szeredi wrote: > > But I still think this approach should work. Untested, might eat your > children, so please don't apply to any kernel. Yes, something like that should work. The important part is to not do the "TestClearPageDirty()" separately, the rest of it ca

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Miklos Szeredi
> > How about doing it in a separate pass, similarly to > > wait_on_page_writeback()? Just instead of waiting, clean the page > > tables for writeback pages. > > That sounds like a good idea, but it doesn't work. > > The thing is, we need to hold the page-table lock over the whole sequence > of

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Linus Torvalds
On Wed, 23 Jan 2008, Hugh Dickins wrote: > > Something I dislike about it, though, is that it leaves the RAM-backed > filesystems (ramfs, tmpfs, whatever) behaving visibly differently from > the others. I hear you. But I'm not seeing many alternatives, unless we start taking write faults on

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Hugh Dickins
On Wed, 23 Jan 2008, Linus Torvalds wrote: > On Wed, 23 Jan 2008, Miklos Szeredi wrote: > > > Sure, I would have though all of this stuff is 2.6.25, but it's your > > kernel... :) > > Well, the plain added "file_update_time()" call addition looked like a > trivial fix, and if there are actually

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Linus Torvalds
On Wed, 23 Jan 2008, Miklos Szeredi wrote: > > Yeah, nasty. > > How about doing it in a separate pass, similarly to > wait_on_page_writeback()? Just instead of waiting, clean the page > tables for writeback pages. That sounds like a good idea, but it doesn't work. The thing is, we need to ho

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Miklos Szeredi
> So it's not horribly hard, but it's kind of a separate issue right now. > And while the *generic* page-writeback is easy enough to fix, I worry > about low-level filesystems that have their own "writepages()" > implementation. They could easily get that wrong. Yeah, nasty. How about doing it

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Linus Torvalds
On Wed, 23 Jan 2008, Miklos Szeredi wrote: > > > [ Side note: it is quite possible that we should not do the > > SYNC_FILE_RANGE_WAIT_BEFORE on MS_ASYNC, and just skip over pages that > > are busily under writeback already. > > MS_ASYNC is not supposed to wait, so SYNC_FILE_RANGE_WAIT_BEFO

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Miklos Szeredi
> > > > It would need some addition piece to not call msync_interval() for > > MS_SYNC, and remove the balance_dirty_pages_ratelimited_nr() stuff. > > > > But yeah, this pte walker is much better. > > Actually, I think this patch is much better. > > Anyway, it's better because: > - it actual

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Linus Torvalds
On Wed, 23 Jan 2008, Peter Zijlstra wrote: > > It would need some addition piece to not call msync_interval() for > MS_SYNC, and remove the balance_dirty_pages_ratelimited_nr() stuff. > > But yeah, this pte walker is much better. Actually, I think this patch is much better. Anyway, it's bet

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Peter Zijlstra
On Wed, 2008-01-23 at 09:05 -0800, Linus Torvalds wrote: > So here's even a patch to get you started. Do this: > > git revert 204ec841fbea3e5138168edbc3a76d46747cc987 > > and then use this appended patch on top of that as a starting point for > something that compiles and *possibly* work

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Anton Salikhmetov
2008/1/23, Linus Torvalds <[EMAIL PROTECTED]>: > > > On Wed, 23 Jan 2008, Anton Salikhmetov wrote: > > + > > + if (pte_dirty(*pte) && pte_write(*pte)) { > > Not correct. > > You still need to check "pte_present()" before you can test any other > bits. For a non-present pte, none of the

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Linus Torvalds
On Wed, 23 Jan 2008, Anton Salikhmetov wrote: > + > + if (pte_dirty(*pte) && pte_write(*pte)) { Not correct. You still need to check "pte_present()" before you can test any other bits. For a non-present pte, none of the other bits are defined, and for all we know there might be ar

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Anton Salikhmetov
2008/1/23, Miklos Szeredi <[EMAIL PROTECTED]>: > > > Also, it still doesn't make sense to me why we'd not need to walk the > > > rmap, it is all the same file after all. > > > > It's the same file, but not the same memory map. It basically depends > > on how you define msync: > > > > a) sync _fil

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Anton Salikhmetov
2008/1/23, Peter Zijlstra <[EMAIL PROTECTED]>: > > On Wed, 2008-01-23 at 02:21 +0300, Anton Salikhmetov wrote: > > > +static void vma_wrprotect_pmd_range(struct vm_area_struct *vma, pmd_t *pmd, > > + unsigned long start, unsigned long end) > > +{ > > + while (start < end) { > > +

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Miklos Szeredi
> > Also, it still doesn't make sense to me why we'd not need to walk the > > rmap, it is all the same file after all. > > It's the same file, but not the same memory map. It basically depends > on how you define msync: > > a) sync _file_ on region defined by this mmap/start/end-address > b) s

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Miklos Szeredi
> Force file times update at the next write reference after > calling the msync() system call with the MS_ASYNC flag. > > Signed-off-by: Anton Salikhmetov <[EMAIL PROTECTED]> > --- > mm/msync.c | 92 +-- > 1 files changed, 82 insertions(+)

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Miklos Szeredi
> On Wed, 2008-01-23 at 09:47 +0100, Peter Zijlstra wrote: > > On Wed, 2008-01-23 at 02:21 +0300, Anton Salikhmetov wrote: > > > > +static void vma_wrprotect(struct vm_area_struct *vma) > > > +{ > > > + unsigned long addr = vma->vm_start; > > > + pgd_t *pgd = pgd_offset(vma->vm_mm, addr); > > > +

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Peter Zijlstra
On Wed, 2008-01-23 at 09:47 +0100, Peter Zijlstra wrote: > On Wed, 2008-01-23 at 02:21 +0300, Anton Salikhmetov wrote: > > +static void vma_wrprotect(struct vm_area_struct *vma) > > +{ > > + unsigned long addr = vma->vm_start; > > + pgd_t *pgd = pgd_offset(vma->vm_mm, addr); > > + > > + whi

Re: [PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-23 Thread Peter Zijlstra
On Wed, 2008-01-23 at 02:21 +0300, Anton Salikhmetov wrote: > +static void vma_wrprotect_pmd_range(struct vm_area_struct *vma, pmd_t *pmd, > + unsigned long start, unsigned long end) > +{ > + while (start < end) { > + spinlock_t *ptl; > + pte_t *pte = pte_o

[PATCH -v8 3/4] Enable the MS_ASYNC functionality in sys_msync()

2008-01-22 Thread Anton Salikhmetov
Force file times update at the next write reference after calling the msync() system call with the MS_ASYNC flag. Signed-off-by: Anton Salikhmetov <[EMAIL PROTECTED]> --- mm/msync.c | 92 +-- 1 files changed, 82 insertions(+), 10 deletions