public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: Nate Diller <nate.diller@gmail.com>,
	Satyam Sharma <satyam.sharma@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] zero_user_page uses in fs/buffer.c and fs/libfs.c
Date: Tue, 1 May 2007 21:09:55 -0700	[thread overview]
Message-ID: <20070501210955.d2c3d682.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0705012046120.28655@schroedinger.engr.sgi.com>

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.

      reply	other threads:[~2007-05-02  4:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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=20070501210955.d2c3d682.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nate.diller@gmail.com \
    --cc=satyam.sharma@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox