public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
@ 2007-04-30  6:14 Christoph Lameter
  2007-04-30  6:53 ` Satyam Sharma
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2007-04-30  6:14 UTC (permalink / raw)
  To: akpm; +Cc: Nate Diller, linux-kernel

There are a couple of places where kmap_atomic is surrounding two
memory operations. Usually only one of them is performed. So it is
possible to also use zero_user_page there.

Cc: Nate Diller <nate.diller@gmail.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 fs/buffer.c |   29 ++++++++++-------------------
 fs/libfs.c  |   12 ++++++------
 2 files changed, 16 insertions(+), 25 deletions(-)

Index: linux-2.6.21-rc7-mm1/fs/buffer.c
===================================================================
--- linux-2.6.21-rc7-mm1.orig/fs/buffer.c	2007-04-25 00:20:35.000000000 -0700
+++ linux-2.6.21-rc7-mm1/fs/buffer.c	2007-04-25 00:24:05.000000000 -0700
@@ -1796,19 +1796,12 @@ static int __block_prepare_write(struct 
 					set_buffer_uptodate(bh);
 					continue;
 				}
-				if (block_end > to || block_start < from) {
-					void *kaddr;
-
-					kaddr = kmap_atomic(page, KM_USER0);
-					if (block_end > to)
-						memset(kaddr+to, 0,
-							block_end-to);
-					if (block_start < from)
-						memset(kaddr+block_start,
-							0, from-block_start);
-					flush_dcache_page(page);
-					kunmap_atomic(kaddr, KM_USER0);
-				}
+				if (block_end > to)
+					zero_user_page(page, to,
+						block_end - to, KM_USER0);
+				if (block_start < from)
+					zero_user_page(page, block_start,
+						from - block_start, KM_USER0);
 				continue;
 			}
 		}
@@ -2224,7 +2217,6 @@ int nobh_prepare_write(struct page *page
 	unsigned block_in_page;
 	unsigned block_start;
 	sector_t block_in_file;
-	char *kaddr;
 	int nr_reads = 0;
 	int i;
 	int ret = 0;
@@ -2264,13 +2256,12 @@ int nobh_prepare_write(struct page *page
 		if (PageUptodate(page))
 			continue;
 		if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) {
-			kaddr = kmap_atomic(page, KM_USER0);
 			if (block_start < from)
-				memset(kaddr+block_start, 0, from-block_start);
+				zero_user_page(page, block_start,
+					from - block_start, KM_USER0);
 			if (block_end > to)
-				memset(kaddr + to, 0, block_end - to);
-			flush_dcache_page(page);
-			kunmap_atomic(kaddr, KM_USER0);
+				zero_user_page(page, to,
+					block_end - to, KM_USER0);
 			continue;
 		}
 		if (buffer_uptodate(&map_bh))
Index: linux-2.6.21-rc7-mm1/fs/libfs.c
===================================================================
--- linux-2.6.21-rc7-mm1.orig/fs/libfs.c	2007-04-25 00:24:10.000000000 -0700
+++ linux-2.6.21-rc7-mm1/fs/libfs.c	2007-04-25 00:25:56.000000000 -0700
@@ -337,12 +337,12 @@ int simple_prepare_write(struct file *fi
 			unsigned from, unsigned to)
 {
 	if (!PageUptodate(page)) {
-		if (to - from != PAGE_CACHE_SIZE) {
-			void *kaddr = kmap_atomic(page, KM_USER0);
-			memset(kaddr, 0, from);
-			memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
-			flush_dcache_page(page);
-			kunmap_atomic(kaddr, KM_USER0);
+		if (to - from != PAGE_CACHE_SIZE)
+			if (from)
+				zero_user_page(page, 0, from, KM_USER0);
+			if (to < PAGE_CACHE_SIZE)
+				zero_user_page(page, to,
+					PAGE_CACHE_SIZE - to, KM_USER0);
 		}
 	}
 	return 0;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-04-30  6:14 [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c Christoph Lameter
@ 2007-04-30  6:53 ` Satyam Sharma
  2007-04-30  7:04   ` Christoph Lameter
  0 siblings, 1 reply; 9+ messages in thread
From: Satyam Sharma @ 2007-04-30  6:53 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: akpm, Nate Diller, linux-kernel

On 4/30/07, Christoph Lameter <clameter@sgi.com> wrote:
> There are a couple of places where kmap_atomic is surrounding two
> memory operations. Usually only one of them is performed. So it is
> possible to also use zero_user_page there.

I do like the patch, but would prefer if you'd give a better/correct
rationale here. "Usually only one of them is performed" is not exactly
correct to say, as it is perfectly (and frequently so) possible for
both of (block_end > to) and (block_start < from) to be true for the
same page for the prepare_write cases.

A simple "Replace open-coded kmap_atomic() and kunmap_atomic()
surrounding two memory clear operations with zero_user_page(), as both
memory operations act on the same page" would have been better.

Perhaps you were more worried with the additional overhead of two
successive kmap_atomic() and kunmap_atomic() calls for the same page
in the two resulting zero_user_page()'s (if both conditions evaluate
to true for the same page), but that would still be a price to pay to
replace the current open-coding.

> --- linux-2.6.21-rc7-mm1.orig/fs/libfs.c        2007-04-25 00:24:10.000000000 -0700
> +++ linux-2.6.21-rc7-mm1/fs/libfs.c     2007-04-25 00:25:56.000000000 -0700
> @@ -337,12 +337,12 @@ int simple_prepare_write(struct file *fi
>                         unsigned from, unsigned to)
>  {
>         if (!PageUptodate(page)) {
> -               if (to - from != PAGE_CACHE_SIZE) {
> -                       void *kaddr = kmap_atomic(page, KM_USER0);
> -                       memset(kaddr, 0, from);
> -                       memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
> -                       flush_dcache_page(page);
> -                       kunmap_atomic(kaddr, KM_USER0);
> +               if (to - from != PAGE_CACHE_SIZE)
> +                       if (from)
> +                               zero_user_page(page, 0, from, KM_USER0);
> +                       if (to < PAGE_CACHE_SIZE)
> +                               zero_user_page(page, to,
> +                                       PAGE_CACHE_SIZE - to, KM_USER0);

Why the two additional condition checks? The previous code didn't have
(or need) them, so this patch clearly does something more than simply
replacing open-coding with zero_user_page().

Either you've fixed an issue (in which case this should've been a
different patch with the accompanying explanation) or else I don't see
what we gain with the additional if's. Again, we still do incur the
overhead of two successive kmap_atomic() / kunmap_atomic() calls for
the same page in order to replace the open-coding.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-04-30  6:53 ` Satyam Sharma
@ 2007-04-30  7:04   ` Christoph Lameter
  2007-05-02  0:26     ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2007-04-30  7:04 UTC (permalink / raw)
  To: Satyam Sharma; +Cc: akpm, Nate Diller, linux-kernel

On Mon, 30 Apr 2007, Satyam Sharma wrote:

> A simple "Replace open-coded kmap_atomic() and kunmap_atomic()
> surrounding two memory clear operations with zero_user_page(), as both
> memory operations act on the same page" would have been better.

Ok.

> Perhaps you were more worried with the additional overhead of two
> successive kmap_atomic() and kunmap_atomic() calls for the same page
> in the two resulting zero_user_page()'s (if both conditions evaluate
> to true for the same page), but that would still be a price to pay to
> replace the current open-coding.

Right.

> Either you've fixed an issue (in which case this should've been a
> different patch with the accompanying explanation) or else I don't see
> what we gain with the additional if's. Again, we still do incur the
> overhead of two successive kmap_atomic() / kunmap_atomic() calls for
> the same page in order to replace the open-coding.

We also flush the page twice. I think its worth the savings.
 
Revised patch (fixes missing { due to missing quilt refresh):


zero_user_page: Use it in more places

Replace open-coded kmap_atomic() and kunmap_atomic()
surrounding two memory clear operations with zero_user_page(), as both
memory operations act on the same page.

Cc: Nate Diller <nate.diller@gmail.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
 fs/buffer.c |   29 ++++++++++-------------------
 fs/libfs.c  |   10 +++++-----
 2 files changed, 15 insertions(+), 24 deletions(-)

Index: linux-2.6.21-rc7-mm2/fs/buffer.c
===================================================================
--- linux-2.6.21-rc7-mm2.orig/fs/buffer.c	2007-04-27 22:51:27.000000000 -0700
+++ linux-2.6.21-rc7-mm2/fs/buffer.c	2007-04-29 23:58:48.000000000 -0700
@@ -1796,19 +1796,12 @@ static int __block_prepare_write(struct 
 					set_buffer_uptodate(bh);
 					continue;
 				}
-				if (block_end > to || block_start < from) {
-					void *kaddr;
-
-					kaddr = kmap_atomic(page, KM_USER0);
-					if (block_end > to)
-						memset(kaddr+to, 0,
-							block_end-to);
-					if (block_start < from)
-						memset(kaddr+block_start,
-							0, from-block_start);
-					flush_dcache_page(page);
-					kunmap_atomic(kaddr, KM_USER0);
-				}
+				if (block_end > to)
+					zero_user_page(page, to,
+						block_end - to, KM_USER0);
+				if (block_start < from)
+					zero_user_page(page, block_start,
+						from - block_start, KM_USER0);
 				continue;
 			}
 		}
@@ -2224,7 +2217,6 @@ int nobh_prepare_write(struct page *page
 	unsigned block_in_page;
 	unsigned block_start;
 	sector_t block_in_file;
-	char *kaddr;
 	int nr_reads = 0;
 	int i;
 	int ret = 0;
@@ -2264,13 +2256,12 @@ int nobh_prepare_write(struct page *page
 		if (PageUptodate(page))
 			continue;
 		if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) {
-			kaddr = kmap_atomic(page, KM_USER0);
 			if (block_start < from)
-				memset(kaddr+block_start, 0, from-block_start);
+				zero_user_page(page, block_start,
+					from - block_start, KM_USER0);
 			if (block_end > to)
-				memset(kaddr + to, 0, block_end - to);
-			flush_dcache_page(page);
-			kunmap_atomic(kaddr, KM_USER0);
+				zero_user_page(page, to,
+					block_end - to, KM_USER0);
 			continue;
 		}
 		if (buffer_uptodate(&map_bh))
Index: linux-2.6.21-rc7-mm2/fs/libfs.c
===================================================================
--- linux-2.6.21-rc7-mm2.orig/fs/libfs.c	2007-04-27 22:51:27.000000000 -0700
+++ linux-2.6.21-rc7-mm2/fs/libfs.c	2007-04-27 22:55:12.000000000 -0700
@@ -338,11 +338,11 @@ int simple_prepare_write(struct file *fi
 {
 	if (!PageUptodate(page)) {
 		if (to - from != PAGE_CACHE_SIZE) {
-			void *kaddr = kmap_atomic(page, KM_USER0);
-			memset(kaddr, 0, from);
-			memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
-			flush_dcache_page(page);
-			kunmap_atomic(kaddr, KM_USER0);
+			if (from)
+				zero_user_page(page, 0, from, KM_USER0);
+			if (to < PAGE_CACHE_SIZE)
+				zero_user_page(page, to,
+					PAGE_CACHE_SIZE - to, KM_USER0);
 		}
 	}
 	return 0;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-04-30  7:04   ` Christoph Lameter
@ 2007-05-02  0:26     ` Andrew Morton
  2007-05-02  1:09       ` Christoph Lameter
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Morton @ 2007-05-02  0:26 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Satyam Sharma, Nate Diller, linux-kernel

On Mon, 30 Apr 2007 00:04:31 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> 
> Replace open-coded kmap_atomic() and kunmap_atomic()
> surrounding two memory clear operations with zero_user_page(), as both
> memory operations act on the same page.
> 
> Cc: Nate Diller <nate.diller@gmail.com>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> 
> ---
>  fs/buffer.c |   29 ++++++++++-------------------
>  fs/libfs.c  |   10 +++++-----
>  2 files changed, 15 insertions(+), 24 deletions(-)
> 
> Index: linux-2.6.21-rc7-mm2/fs/buffer.c
> ===================================================================
> --- linux-2.6.21-rc7-mm2.orig/fs/buffer.c	2007-04-27 22:51:27.000000000 -0700
> +++ linux-2.6.21-rc7-mm2/fs/buffer.c	2007-04-29 23:58:48.000000000 -0700
> @@ -1796,19 +1796,12 @@ static int __block_prepare_write(struct 
>  					set_buffer_uptodate(bh);
>  					continue;
>  				}
> -				if (block_end > to || block_start < from) {
> -					void *kaddr;
> -
> -					kaddr = kmap_atomic(page, KM_USER0);
> -					if (block_end > to)
> -						memset(kaddr+to, 0,
> -							block_end-to);
> -					if (block_start < from)
> -						memset(kaddr+block_start,
> -							0, from-block_start);
> -					flush_dcache_page(page);
> -					kunmap_atomic(kaddr, KM_USER0);
> -				}
> +				if (block_end > to)
> +					zero_user_page(page, to,
> +						block_end - to, KM_USER0);
> +				if (block_start < from)
> +					zero_user_page(page, block_start,
> +						from - block_start, KM_USER0);
>  				continue;
>  			}
>  		}
> @@ -2224,7 +2217,6 @@ int nobh_prepare_write(struct page *page
>  	unsigned block_in_page;
>  	unsigned block_start;
>  	sector_t block_in_file;
> -	char *kaddr;
>  	int nr_reads = 0;
>  	int i;
>  	int ret = 0;
> @@ -2264,13 +2256,12 @@ int nobh_prepare_write(struct page *page
>  		if (PageUptodate(page))
>  			continue;
>  		if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) {
> -			kaddr = kmap_atomic(page, KM_USER0);
>  			if (block_start < from)
> -				memset(kaddr+block_start, 0, from-block_start);
> +				zero_user_page(page, block_start,
> +					from - block_start, KM_USER0);
>  			if (block_end > to)
> -				memset(kaddr + to, 0, block_end - to);
> -			flush_dcache_page(page);
> -			kunmap_atomic(kaddr, KM_USER0);
> +				zero_user_page(page, to,
> +					block_end - to, KM_USER0);
>  			continue;
>  		}
>  		if (buffer_uptodate(&map_bh))
> Index: linux-2.6.21-rc7-mm2/fs/libfs.c
> ===================================================================
> --- linux-2.6.21-rc7-mm2.orig/fs/libfs.c	2007-04-27 22:51:27.000000000 -0700
> +++ linux-2.6.21-rc7-mm2/fs/libfs.c	2007-04-27 22:55:12.000000000 -0700
> @@ -338,11 +338,11 @@ int simple_prepare_write(struct file *fi
>  {
>  	if (!PageUptodate(page)) {
>  		if (to - from != PAGE_CACHE_SIZE) {
> -			void *kaddr = kmap_atomic(page, KM_USER0);
> -			memset(kaddr, 0, from);
> -			memset(kaddr + to, 0, PAGE_CACHE_SIZE - to);
> -			flush_dcache_page(page);
> -			kunmap_atomic(kaddr, KM_USER0);
> +			if (from)
> +				zero_user_page(page, 0, from, KM_USER0);
> +			if (to < PAGE_CACHE_SIZE)
> +				zero_user_page(page, to,
> +					PAGE_CACHE_SIZE - to, KM_USER0);
>  		}
>  	}
>  	return 0;

As Satyam said, this will sometimes cause us to map and unmap the page
twice, and to run flush_dcache_page() twice.  In not-terribly-uncommon
circumstances in very frequently called functions.

Doesn't seem worth it to me.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-05-02  0:26     ` Andrew Morton
@ 2007-05-02  1:09       ` Christoph Lameter
  2007-05-02  2:16         ` Nate Diller
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2007-05-02  1:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Satyam Sharma, Nate Diller, linux-kernel

On Tue, 1 May 2007, Andrew Morton wrote:

> As Satyam said, this will sometimes cause us to map and unmap the page
> twice, and to run flush_dcache_page() twice.  In not-terribly-uncommon
> circumstances in very frequently called functions.
> 
> Doesn't seem worth it to me.

Ok but we have that code three times. Should I add a variant of 
zero_user_page that zeroes everything but the section specified?

zero_user_page_allbut() ?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-05-02  1:09       ` Christoph Lameter
@ 2007-05-02  2:16         ` Nate Diller
  2007-05-02  2:27           ` Nate Diller
  0 siblings, 1 reply; 9+ messages in thread
From: Nate Diller @ 2007-05-02  2:16 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Andrew Morton, Satyam Sharma, linux-kernel

On 5/1/07, Christoph Lameter <clameter@sgi.com> wrote:
> On Tue, 1 May 2007, Andrew Morton wrote:
>
> > As Satyam said, this will sometimes cause us to map and unmap the page
> > twice, and to run flush_dcache_page() twice.  In not-terribly-uncommon
> > circumstances in very frequently called functions.
> >
> > Doesn't seem worth it to me.
>
> Ok but we have that code three times. Should I add a variant of
> zero_user_page that zeroes everything but the section specified?
>
> zero_user_page_allbut() ?

the function already exists, it's called simple_prepare_write(), and i
thought there were patches to convert those callsites in -mm ...
although it looks like i let a review comment on that slide by.  I
need to redo a bunch of patches for re-submission anyway, so i guess
i'll deal with that tomorrow.

NATE

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-05-02  2:16         ` Nate Diller
@ 2007-05-02  2:27           ` Nate Diller
  2007-05-02  3:58             ` Christoph Lameter
  0 siblings, 1 reply; 9+ messages in thread
From: Nate Diller @ 2007-05-02  2:27 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Andrew Morton, Satyam Sharma, linux-kernel

On 5/1/07, Nate Diller <nate.diller@gmail.com> wrote:
> On 5/1/07, Christoph Lameter <clameter@sgi.com> wrote:
> > On Tue, 1 May 2007, Andrew Morton wrote:
> >
> > > As Satyam said, this will sometimes cause us to map and unmap the page
> > > twice, and to run flush_dcache_page() twice.  In not-terribly-uncommon
> > > circumstances in very frequently called functions.
> > >
> > > Doesn't seem worth it to me.
> >
> > Ok but we have that code three times. Should I add a variant of
> > zero_user_page that zeroes everything but the section specified?
> >
> > zero_user_page_allbut() ?
>
> the function already exists, it's called simple_prepare_write(), and i
> thought there were patches to convert those callsites in -mm ...
> although it looks like i let a review comment on that slide by.  I
> need to redo a bunch of patches for re-submission anyway, so i guess
> i'll deal with that tomorrow.
>
> NATE
>

well, leave it to me to reply too quickly, sorry.  i think we should
leave simple_prepare_write() the way it is, since it's a library
function itself.  the other two callsites in your patch are buffers,
which may themselves be smaller than a page so you would need a
special function for just those two uses, there's no other way to
avoid making two calls to flush_dcache_page().  if it's tremendously
important to you to eliminate open coding of these, maybe make a
'static int buffer_prepare_write()' or some such in fs/buffer.c

NATE

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-05-02  2:27           ` Nate Diller
@ 2007-05-02  3:58             ` Christoph Lameter
  2007-05-02  4:09               ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Lameter @ 2007-05-02  3:58 UTC (permalink / raw)
  To: Nate Diller; +Cc: Andrew Morton, Satyam Sharma, linux-kernel

On Tue, 1 May 2007, Nate Diller wrote:

> well, leave it to me to reply too quickly, sorry.  i think we should
> leave simple_prepare_write() the way it is, since it's a library
> function itself.  the other two callsites in your patch are buffers,
> which may themselves be smaller than a page so you would need a
> special function for just those two uses, there's no other way to
> avoid making two calls to flush_dcache_page().  if it's tremendously
> important to you to eliminate open coding of these, maybe make a
> 'static int buffer_prepare_write()' or some such in fs/buffer.c

All three sites zap two parts of a page. If we had a 
zero_user_page2 like this

zero_user_page2(page, start1, end1, start2, end2, kmap)

then all 3 sites could use the same funtion.

libfs.c:

zero_user_page_segments(page, 0, from, to, PAGE_CACHE_SIZE, KM_USER0);

buffer.c:

zero_user_page_segments(page, from, block_start, to, block_end, KM_USER0)

zero_user_page_segments(page, blockstart, from, to, block_end, KM_USER0)


I did not look through the whole kernel but this zapping segments is 
likely frequent given the nature of the blocklayer.

The 3 call sites pretty ugly on their own. I think it would be good 
to have one clearly commented version of this somewhere. Call sites
will be much clearer since you do not have the kmap_ obfuscation nor
the calculation of the length of each segment.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
  2007-05-02  3:58             ` Christoph Lameter
@ 2007-05-02  4:09               ` Andrew Morton
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Morton @ 2007-05-02  4:09 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Nate Diller, Satyam Sharma, linux-kernel

On Tue, 1 May 2007 20:58:02 -0700 (PDT) Christoph Lameter <clameter@sgi.com> wrote:

> On Tue, 1 May 2007, Nate Diller wrote:
> 
> > well, leave it to me to reply too quickly, sorry.  i think we should
> > leave simple_prepare_write() the way it is, since it's a library
> > function itself.  the other two callsites in your patch are buffers,
> > which may themselves be smaller than a page so you would need a
> > special function for just those two uses, there's no other way to
> > avoid making two calls to flush_dcache_page().  if it's tremendously
> > important to you to eliminate open coding of these, maybe make a
> > 'static int buffer_prepare_write()' or some such in fs/buffer.c
> 
> All three sites zap two parts of a page. If we had a 
> zero_user_page2 like this
> 
> zero_user_page2(page, start1, end1, start2, end2, kmap)
> 
> then all 3 sites could use the same funtion.
> 
> libfs.c:
> 
> zero_user_page_segments(page, 0, from, to, PAGE_CACHE_SIZE, KM_USER0);
> 
> buffer.c:
> 
> zero_user_page_segments(page, from, block_start, to, block_end, KM_USER0)
> 
> zero_user_page_segments(page, blockstart, from, to, block_end, KM_USER0)
> 

yup.  And perhaps zero_user_page() becomes a caller to
zero_user_page_segments() if we're sure that the compiler will dtrt.

> 
> I did not look through the whole kernel but this zapping segments is 
> likely frequent given the nature of the blocklayer.
> 
> The 3 call sites pretty ugly on their own. I think it would be good 
> to have one clearly commented version of this somewhere. Call sites
> will be much clearer since you do not have the kmap_ obfuscation nor
> the calculation of the length of each segment.

Sure.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-05-02  4:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-30  6:14 [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c Christoph Lameter
2007-04-30  6:53 ` Satyam Sharma
2007-04-30  7:04   ` Christoph Lameter
2007-05-02  0:26     ` Andrew Morton
2007-05-02  1:09       ` Christoph Lameter
2007-05-02  2:16         ` Nate Diller
2007-05-02  2:27           ` Nate Diller
2007-05-02  3:58             ` Christoph Lameter
2007-05-02  4:09               ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox