linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@osdl.org>,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] ide-scsi highmem cleanup
Date: Sun, 30 Oct 2005 22:48:20 -0500	[thread overview]
Message-ID: <43659404.6050605@pobox.com> (raw)
In-Reply-To: <200510310302.j9V32hO4009277@hera.kernel.org>

Linux Kernel Mailing List wrote:
> tree c6016a8741a2527acac0ceb6e6ce431a798d6708
> parent f1fc78a8c7f3a784b9fd1e07cc1438a0ea569555
> author Andrew Morton <akpm@osdl.org> Mon, 31 Oct 2005 07:00:13 -0800
> committer Linus Torvalds <torvalds@g5.osdl.org> Mon, 31 Oct 2005 09:37:17 -0800
> 
> [PATCH] ide-scsi highmem cleanup
> 
> It's not necessary to test PageHighmem in here - kmap_atomic() does the right
> thing.
> 
> Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
> Signed-off-by: Andrew Morton <akpm@osdl.org>
> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
> 
>  drivers/scsi/ide-scsi.c |   38 ++++++++++++--------------------------
>  1 files changed, 12 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
> --- a/drivers/scsi/ide-scsi.c
> +++ b/drivers/scsi/ide-scsi.c
> @@ -180,19 +180,12 @@ static void idescsi_input_buffers (ide_d
>  			return;
>  		}
>  		count = min(pc->sg->length - pc->b_count, bcount);
> -		if (PageHighMem(pc->sg->page)) {
> -			unsigned long flags;
> -
> -			local_irq_save(flags);
> -			buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset;
> -			drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count);
> -			kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
> -			local_irq_restore(flags);
> -		} else {
> -			buf = page_address(pc->sg->page) + pc->sg->offset;
> -			drive->hwif->atapi_input_bytes(drive, buf + pc->b_count, count);
> -		}
> -		bcount -= count; pc->b_count += count;
> +		buf = kmap_atomic(pc->sg->page, KM_IRQ0);
> +		drive->hwif->atapi_input_bytes(drive,
> +				buf + pc->b_count + pc->sg->offset, count);
> +		kunmap_atomic(buf, KM_IRQ0);
> +		bcount -= count;
> +		pc->b_count += count;
>  		if (pc->b_count == pc->sg->length) {
>  			pc->sg++;
>  			pc->b_count = 0;
> @@ -212,19 +205,12 @@ static void idescsi_output_buffers (ide_
>  			return;
>  		}
>  		count = min(pc->sg->length - pc->b_count, bcount);
> -		if (PageHighMem(pc->sg->page)) {
> -			unsigned long flags;
> -
> -			local_irq_save(flags);
> -			buf = kmap_atomic(pc->sg->page, KM_IRQ0) + pc->sg->offset;
> -			drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
> -			kunmap_atomic(buf - pc->sg->offset, KM_IRQ0);
> -			local_irq_restore(flags);
> -		} else {
> -			buf = page_address(pc->sg->page) + pc->sg->offset;
> -			drive->hwif->atapi_output_bytes(drive, buf + pc->b_count, count);
> -		}
> -		bcount -= count; pc->b_count += count;
> +		buf = kmap_atomic(pc->sg->page, KM_IRQ0);
> +		drive->hwif->atapi_output_bytes(drive,
> +				buf + pc->b_count + pc->sg->offset, count);
> +		kunmap_atomic(buf, KM_IRQ0);
> +		bcount -= count;
> +		pc->b_count += count;

Unless I'm missing something, this patch looks very wrong.

kmap_atomic(..., KM_IRQx) needs to be inside local_irq_save().

As such, the PageHighMem() does have clear benefits.

	Jeff



       reply	other threads:[~2005-10-31  3:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200510310302.j9V32hO4009277@hera.kernel.org>
2005-10-31  3:48 ` Jeff Garzik [this message]
2005-10-31  4:00   ` [PATCH] ide-scsi highmem cleanup Andrew Morton

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=43659404.6050605@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).