Re: Bugs on Linux 2.6.18-rc2 sg code?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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]

or (if you want to be more correct) something like the nth_page macro in
linux/mm.h?

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.

James


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux