All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	Ingo Molnar <mingo@elte.hu>, Tejun Heo <htejun@gmail.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Hugh Dickins <hugh@veritas.com>,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] Fix kunmap() argument in sg_miter_stop
Date: Mon, 17 Nov 2008 19:07:38 +0100	[thread overview]
Message-ID: <20081117180738.GW26778@kernel.dk> (raw)
In-Reply-To: <alpine.LFD.2.00.0811170922000.3468@nehalem.linux-foundation.org>

On Mon, Nov 17 2008, Linus Torvalds wrote:
> 
> 
> On Mon, 17 Nov 2008, Jeremy Fitzhardinge wrote:
> 
> > Pass the struct page * to kunmap, not the vaddr of the mapping itself.
> > 
> > Pointed out by Jens Axboe <jens.axboe@oracle.com>
> > 
> > Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> > ---
> > drivers/xen/balloon.c |    2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > ===================================================================
> > --- a/drivers/xen/balloon.c
> > +++ b/drivers/xen/balloon.c
> > @@ -120,7 +120,7 @@
> > 	if (PageHighMem(page)) {
> > 		void *v = kmap(page);
> > 		clear_page(v);
> > -		kunmap(v);
> > +		kunmap(page);
> > 	} else {
> > 		void *v = page_address(page);
> > 		clear_page(v);
> 
> Well, quite frankly, the whole thing looks like crud.
> 
> First off, 'kmap/kunmap' work on regular pages too. So if you're highmem 
> aware, you should just do
> 
> 	void *v = kmap(page);
> 	clear_page(v);
> 	kunmap(page);
> 
> and be done with it. 
> 
> Secondly, we actually have a function called "clear_highpage()" that does 
> this, except it uses kmap_atomic(page, KM_USER0). Which is _probably 
> better anyway, but I didn't check if there is some magical reason why it 
> wouldn't work.

Indeed, scrub_page() should just be eliminated.

Any opinions on the kunmap/kunmap_atomic pointer checking? It's a bit
ugly that we have to enforce a void * rule for kunmap_atomic(), but
it'll definitely catch bugs. So I think it's worth it, I'd like to hear
your opinion before I queue it for 2.6.29 though.

-- 
Jens Axboe


  parent reply	other threads:[~2008-11-17 18:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-15 19:27 [PATCH] Fix kunmap() argument in sg_miter_stop Arjan van de Ven
2008-11-15 20:15 ` Hugh Dickins
2008-11-15 20:27   ` Arjan van de Ven
2008-11-15 20:39   ` Arjan van de Ven
2008-11-16  5:16     ` Tejun Heo
2008-11-17  8:11       ` Jens Axboe
2008-11-17  8:22         ` Ingo Molnar
2008-11-17  8:30           ` Jens Axboe
2008-11-17  8:50             ` Ingo Molnar
2008-11-17  8:58               ` Jens Axboe
2008-11-17  9:34                 ` Jens Axboe
2008-11-17  9:41                   ` Ingo Molnar
2008-11-17  9:45                     ` Jens Axboe
2008-11-17 11:13                       ` Jens Axboe
2008-11-17 17:08                         ` Jeremy Fitzhardinge
2008-11-17 17:10                           ` Ingo Molnar
2008-11-17 17:15                             ` Jeremy Fitzhardinge
2008-11-17 17:25                               ` Linus Torvalds
2008-11-17 17:35                                 ` Jeremy Fitzhardinge
2008-11-17 18:14                                   ` [PATCH] xen: fix scrub_page() Ingo Molnar
2008-11-17 18:07                                 ` Jens Axboe [this message]
2008-11-17 18:16                                   ` [PATCH] Fix kunmap() argument in sg_miter_stop Linus Torvalds
2008-11-17 18:26                                     ` Jens Axboe
2008-11-18  8:27                                       ` Ingo Molnar

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=20081117180738.GW26778@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=htejun@gmail.com \
    --cc=hugh@veritas.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    /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.