All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: JBeulich@novell.com, linux-kernel@vger.kernel.org, rjw@sisk.pl,
	miklos@szeredi.hu
Subject: Re: [PATCH] use clear_page()/copy_page() in favor of memset()/memcpy() on whole pages
Date: Wed, 15 Sep 2010 08:32:50 +0200	[thread overview]
Message-ID: <E1OvlY2-0004Vd-Ss@pomaz-ex.szeredi.hu> (raw)
In-Reply-To: <20100914160654.20c91c22.akpm@linux-foundation.org> (message from Andrew Morton on Tue, 14 Sep 2010 16:06:54 -0700)

On Tue, 14 Sep 2010, Andrew Morton wrote:
> On Thu, 02 Sep 2010 13:30:37 +0100
> "Jan Beulich" <JBeulich@novell.com> wrote:
> 
> > After all that's what they are intended for.
> > 
> > ...
> >
> > --- linux-2.6.36-rc3/fs/fuse/dev.c
> > +++ 2.6.36-rc3-use-clear_page/fs/fuse/dev.c
> > @@ -811,7 +811,7 @@ static int fuse_copy_page(struct fuse_co
> >  
> >  	if (page && zeroing && count < PAGE_SIZE) {
> >  		void *mapaddr = kmap_atomic(page, KM_USER1);
> > -		memset(mapaddr, 0, PAGE_SIZE);
> > +		clear_page(mapaddr);
> >  		kunmap_atomic(mapaddr, KM_USER1);
> >  	}
> >  	while (count) {
> 
> fuse wanted to use clear_highpage() here.  But clear_highpage() uses
> KM_USER0.  I don't immediately see why fuse uses KM_USER1 here?

There used to be KM_USER0 kmaps in there, but now they've been
replaced with plain kmaps.  So switching to clear_highpage() should be
fine.

Incremental patch appended.

Thanks,
Miklos
----

Subject: fuse: use clear_highpage() and  KM_USER0 instead of KM_USER1
From: Miklos Szeredi <mszeredi@suse.cz>

Commit 7909b1c640 (fuse: don't use atomic kmap) removed KM_USER0 usage
from fuse/dev.c.  Switch KM_USER1 uses to KM_USER0 for clarity.  Also
replace open coded clear_highpage().

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
 fs/fuse/dev.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Index: linux-2.6/fs/fuse/dev.c
===================================================================
--- linux-2.6.orig/fs/fuse/dev.c	2010-09-15 08:22:34.000000000 +0200
+++ linux-2.6/fs/fuse/dev.c	2010-09-15 08:24:30.000000000 +0200
@@ -809,11 +809,9 @@ static int fuse_copy_page(struct fuse_co
 	int err;
 	struct page *page = *pagep;
 
-	if (page && zeroing && count < PAGE_SIZE) {
-		void *mapaddr = kmap_atomic(page, KM_USER1);
-		clear_page(mapaddr);
-		kunmap_atomic(mapaddr, KM_USER1);
-	}
+	if (page && zeroing && count < PAGE_SIZE)
+		clear_highpage(page);
+
 	while (count) {
 		if (cs->write && cs->pipebufs && page) {
 			return fuse_ref_page(cs, page, offset, count);
@@ -830,10 +828,10 @@ static int fuse_copy_page(struct fuse_co
 			}
 		}
 		if (page) {
-			void *mapaddr = kmap_atomic(page, KM_USER1);
+			void *mapaddr = kmap_atomic(page, KM_USER0);
 			void *buf = mapaddr + offset;
 			offset += fuse_copy_do(cs, &buf, &count);
-			kunmap_atomic(mapaddr, KM_USER1);
+			kunmap_atomic(mapaddr, KM_USER0);
 		} else
 			offset += fuse_copy_do(cs, NULL, &count);
 	}

      parent reply	other threads:[~2010-09-15  6:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-02 12:30 [PATCH] use clear_page()/copy_page() in favor of memset()/memcpy() on whole pages Jan Beulich
2010-09-14 23:06 ` Andrew Morton
2010-09-15  0:11   ` Rafael J. Wysocki
2010-09-15  6:32   ` Miklos Szeredi [this message]

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=E1OvlY2-0004Vd-Ss@pomaz-ex.szeredi.hu \
    --to=miklos@szeredi.hu \
    --cc=JBeulich@novell.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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.