All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@osdl.org>, Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH 4/6] nfs: Teach NFS about swap cache pages
Date: Fri, 25 Aug 2006 22:20:14 +0200	[thread overview]
Message-ID: <1156537214.26945.6.camel@lappy> (raw)
In-Reply-To: <1156536228.5927.17.camel@localhost>

On Fri, 2006-08-25 at 16:03 -0400, Trond Myklebust wrote:
> On Fri, 2006-08-25 at 17:37 +0200, Peter Zijlstra wrote:
> > Teach the NFS client how to treat PG_swapcache pages.
> > 
> > Replace all occurences of page->index and page->mapping in the NFS client
> > with the new page_file_index() and page_file_mapping() functions.
> > 
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > ---
> >  fs/nfs/dir.c      |    4 ++--
> >  fs/nfs/file.c     |    6 +++---
> >  fs/nfs/pagelist.c |    8 ++++----
> >  fs/nfs/read.c     |   10 +++++-----
> >  fs/nfs/write.c    |   34 +++++++++++++++++-----------------
> >  5 files changed, 31 insertions(+), 31 deletions(-)
> 
> <snip>
> 
> > @@ -821,7 +821,7 @@ int nfs_updatepage(struct file *file, st
> >  		unsigned int offset, unsigned int count)
> >  {
> >  	struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
> > -	struct inode	*inode = page->mapping->host;
> > +	struct inode	*inode = page_file_mapping(page)->host;
> >  	struct nfs_page	*req;
> >  	int		status = 0;
> >  
> > @@ -854,12 +854,12 @@ int nfs_updatepage(struct file *file, st
> >  		offset = 0;
> >  		if (unlikely(end_offs < 0)) {
> >  			/* Do nothing */
> > -		} else if (page->index == end_index) {
> > +		} else if (page_file_index(page) == end_index) {
> 
> Is this necessary? When will we ever call nfs_updatepage() with a swap
> page? AFAICS, the swap stuff always uses page dirtying and (ugh)
> writepage().

Yes, swap uses writepage(), Nikita Danilov had a patch that did cluster
pageout using writepages(), however that tended to deadlock even on
local disk.

> >  			unsigned int pglen;
> >  			pglen = (unsigned int)(end_offs & (PAGE_CACHE_SIZE-1)) + 1;
> >  			if (count < pglen)
> >  				count = pglen;
> > -		} else if (page->index < end_index)
> > +		} else if (page_file_index(page) < end_index)
> >  			count = PAGE_CACHE_SIZE;
> >  	}
> >  
> > Index: linux-2.6/fs/nfs/dir.c
> > ===================================================================
> > --- linux-2.6.orig/fs/nfs/dir.c
> > +++ linux-2.6/fs/nfs/dir.c
> > @@ -177,7 +177,7 @@ int nfs_readdir_filler(nfs_readdir_descr
> >  
> >  	dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n",
> >  			__FUNCTION__, (long long)desc->entry->cookie,
> > -			page->index);
> > +			page_file_index(page));
> >  
> >   again:
> >  	timestamp = jiffies;
> > @@ -201,7 +201,7 @@ int nfs_readdir_filler(nfs_readdir_descr
> >  	 * Note: assumes we have exclusive access to this mapping either
> >  	 *	 through inode->i_mutex or some other mechanism.
> >  	 */
> > -	if (page->index == 0)
> > +	if (page_file_index(page) == 0)
> >  		invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1);
> >  	unlock_page(page);
> >  	return 0;
> 
> Why are we worried about the possibility of NFS readdir pages being swap
> pages?

Indiscriminate search and replace followed by a manual check for
correctness. They might not be needed, but they're not wrong either.

Would you prefer I take them out?


WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@osdl.org>, Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH 4/6] nfs: Teach NFS about swap cache pages
Date: Fri, 25 Aug 2006 22:20:14 +0200	[thread overview]
Message-ID: <1156537214.26945.6.camel@lappy> (raw)
In-Reply-To: <1156536228.5927.17.camel@localhost>

On Fri, 2006-08-25 at 16:03 -0400, Trond Myklebust wrote:
> On Fri, 2006-08-25 at 17:37 +0200, Peter Zijlstra wrote:
> > Teach the NFS client how to treat PG_swapcache pages.
> > 
> > Replace all occurences of page->index and page->mapping in the NFS client
> > with the new page_file_index() and page_file_mapping() functions.
> > 
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> > ---
> >  fs/nfs/dir.c      |    4 ++--
> >  fs/nfs/file.c     |    6 +++---
> >  fs/nfs/pagelist.c |    8 ++++----
> >  fs/nfs/read.c     |   10 +++++-----
> >  fs/nfs/write.c    |   34 +++++++++++++++++-----------------
> >  5 files changed, 31 insertions(+), 31 deletions(-)
> 
> <snip>
> 
> > @@ -821,7 +821,7 @@ int nfs_updatepage(struct file *file, st
> >  		unsigned int offset, unsigned int count)
> >  {
> >  	struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
> > -	struct inode	*inode = page->mapping->host;
> > +	struct inode	*inode = page_file_mapping(page)->host;
> >  	struct nfs_page	*req;
> >  	int		status = 0;
> >  
> > @@ -854,12 +854,12 @@ int nfs_updatepage(struct file *file, st
> >  		offset = 0;
> >  		if (unlikely(end_offs < 0)) {
> >  			/* Do nothing */
> > -		} else if (page->index == end_index) {
> > +		} else if (page_file_index(page) == end_index) {
> 
> Is this necessary? When will we ever call nfs_updatepage() with a swap
> page? AFAICS, the swap stuff always uses page dirtying and (ugh)
> writepage().

Yes, swap uses writepage(), Nikita Danilov had a patch that did cluster
pageout using writepages(), however that tended to deadlock even on
local disk.

> >  			unsigned int pglen;
> >  			pglen = (unsigned int)(end_offs & (PAGE_CACHE_SIZE-1)) + 1;
> >  			if (count < pglen)
> >  				count = pglen;
> > -		} else if (page->index < end_index)
> > +		} else if (page_file_index(page) < end_index)
> >  			count = PAGE_CACHE_SIZE;
> >  	}
> >  
> > Index: linux-2.6/fs/nfs/dir.c
> > ===================================================================
> > --- linux-2.6.orig/fs/nfs/dir.c
> > +++ linux-2.6/fs/nfs/dir.c
> > @@ -177,7 +177,7 @@ int nfs_readdir_filler(nfs_readdir_descr
> >  
> >  	dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n",
> >  			__FUNCTION__, (long long)desc->entry->cookie,
> > -			page->index);
> > +			page_file_index(page));
> >  
> >   again:
> >  	timestamp = jiffies;
> > @@ -201,7 +201,7 @@ int nfs_readdir_filler(nfs_readdir_descr
> >  	 * Note: assumes we have exclusive access to this mapping either
> >  	 *	 through inode->i_mutex or some other mechanism.
> >  	 */
> > -	if (page->index == 0)
> > +	if (page_file_index(page) == 0)
> >  		invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1);
> >  	unlock_page(page);
> >  	return 0;
> 
> Why are we worried about the possibility of NFS readdir pages being swap
> pages?

Indiscriminate search and replace followed by a manual check for
correctness. They might not be needed, but they're not wrong either.

Would you prefer I take them out?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2006-08-25 20:21 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25 15:37 [PATCH 0/6] Swap over NFS Peter Zijlstra
2006-08-25 15:37 ` Peter Zijlstra
2006-08-25 15:37 ` [PATCH 1/6] mm: Generic swap file support Peter Zijlstra
2006-08-25 15:37   ` Peter Zijlstra
2006-08-25 15:37 ` [PATCH 2/6] mm: New page_file_* methods Peter Zijlstra
2006-08-25 15:37   ` Peter Zijlstra
2006-08-25 15:37 ` [PATCH 3/6] uml: arch/um remove_mapping() clash Peter Zijlstra
2006-08-25 15:37   ` Peter Zijlstra
2006-08-29 20:20   ` Jeff Dike
2006-08-29 20:20     ` Jeff Dike
2006-08-25 15:37 ` [PATCH 4/6] nfs: Teach NFS about swap cache pages Peter Zijlstra
2006-08-25 15:37   ` Peter Zijlstra
2006-08-25 20:03   ` Trond Myklebust
2006-08-25 20:03     ` Trond Myklebust
2006-08-25 20:20     ` Peter Zijlstra [this message]
2006-08-25 20:20       ` Peter Zijlstra
2006-08-25 20:37       ` Trond Myklebust
2006-08-25 20:37         ` Trond Myklebust
2006-08-25 15:38 ` [PATCH 5/6] nfs: Add comment on PG_private use of NFS Peter Zijlstra
2006-08-25 15:38   ` Peter Zijlstra
2006-08-25 15:38 ` [PATCH 6/6] nfs: Enable swap over NFS Peter Zijlstra
2006-08-25 15:38   ` Peter Zijlstra
2006-08-26 14:36   ` Pavel Machek
2006-08-26 14:36     ` Pavel Machek
2006-08-26 17:30     ` Peter Zijlstra
2006-08-26 17:30       ` Peter Zijlstra
2006-08-26 21:54     ` Rik van Riel
2006-08-26 21:54       ` Rik van Riel
2006-08-25 16:36 ` [PATCH 7/6] Lost bits - fix PG_writeback vs PG_private race in NFS Peter Zijlstra
2006-08-25 16:36   ` Peter Zijlstra
2006-08-25 20:11   ` Trond Myklebust
2006-08-25 20:11     ` Trond Myklebust
2006-08-25 20:44     ` Peter Zijlstra
2006-08-25 20:44       ` Peter Zijlstra
2006-08-25 21:19       ` Trond Myklebust
2006-08-25 21:19         ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1156537214.26945.6.camel@lappy \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.