From: Douglas Gilbert <dougg@torque.net>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Fajun Chen <fajunchen@gmail.com>,
linux-scsi@vger.kernel.org, akpm@osdl.org
Subject: Re: Bugs on Linux 2.6.18-rc2 sg code?
Date: Sat, 19 Aug 2006 21:36:58 -0400 [thread overview]
Message-ID: <44E7BCBA.5080105@torque.net> (raw)
In-Reply-To: <1156013713.3726.10.camel@mulgrave.il.steeleye.com>
James Bottomley wrote:
> On Sat, 2006-08-19 at 00:11 -0400, Douglas Gilbert wrote:
>> @@ -1164,7 +1164,7 @@
>> len = vma->vm_end - sa;
>> len = (len < sg->length) ? len : sg->length;
>> if (offset < len) {
>> - page = sg->page;
>> + page = virt_to_page(page_address(sg->page) + offset);
>> get_page(page); /* increment page count */
>> break;
>> }
>
> Doing something like this always frightens people in linux because
> page_address() on highmem returns NULL. I know, having looked, that in
> this case it can't happen, but since sg->page is really an array of
> pages, how about something simpler like
>
> page = &sg->page[offset >> PAGE_SHIFT]
James,
Yes I saw code like that when I reviewed other vma
"nopage" callbacks. And that code frightens me :-)
> or (if you want to be more correct) something like the nth_page macro in
> linux/mm.h?
That nth_page() macro looks better. Is it guaranteed
not to return NULL? No vma "nopage" callbacks are
using nth_page() so I wasn't aware of it.
> It might also be worthwhile considering GFP_HIGHUSER for this allocation
> (in spite of all the kmap_atomic et al that would have to be added to
> the code), since that will increase the chance of a contiguous
> allocation on large memory machines.
Did you mean GFP_KERNEL | __GFP_HIGHMEM since the
allocation in question is for a scatter gather
list element that will be DMA-ed to or from?
Is the HIGHMEM stuff needed in 64 bits? I looked
at the kmap_atomic stuff and it just didn't look
worth the effort.
All good stuff for the lk 2.6.19 cycle. First I
would like to fix the reported bug with code
that was well tested ...
Doug Gilbert
next prev parent reply other threads:[~2006-08-20 1:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-11 1:43 Bugs on Linux 2.6.18-rc2 sg code? Fajun Chen
2006-08-18 22:00 ` Douglas Gilbert
2006-08-19 4:11 ` Douglas Gilbert
2006-08-19 17:20 ` Matthew Wilcox
2006-08-19 17:36 ` Douglas Gilbert
2006-08-19 17:41 ` Andrew Morton
2006-08-19 20:23 ` Matthew Wilcox
2006-08-20 1:00 ` Douglas Gilbert
2006-08-20 10:07 ` Arjan van de Ven
2006-08-20 17:47 ` Andrew Morton
2006-08-30 16:29 ` Fajun Chen
2006-08-19 18:55 ` James Bottomley
2006-08-20 1:36 ` Douglas Gilbert [this message]
[not found] ` <8202f4270608200051p688f4654ub6aecb604e0152f1@mail.gmail.com>
2006-08-20 9:01 ` Russell King
2006-08-28 21:12 ` Fajun Chen
2006-08-28 22:11 ` Douglas Gilbert
2006-08-21 21:07 ` Fajun Chen
2006-08-22 2:47 ` Douglas Gilbert
2006-08-22 4:27 ` Fajun Chen
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=44E7BCBA.5080105@torque.net \
--to=dougg@torque.net \
--cc=James.Bottomley@SteelEye.com \
--cc=akpm@osdl.org \
--cc=fajunchen@gmail.com \
--cc=linux-scsi@vger.kernel.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.