Re: [patch] sg: simplify page_count manipulations

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

 



On Wed, Jan 18, 2006 at 07:59:37PM -0800, Andrew Morton wrote:
> Nick Piggin <npiggin@xxxxxxx> wrote:
> > -	/* N.B. correction _not_ applied to base page of each allocation */
> > -	for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) {
> > -		for (m = PAGE_SIZE; m < sg->length; m += PAGE_SIZE) {
> > -			page = sg->page;
> > -			if (startFinish)
> > -				get_page(page);
> > -			else {
> > -				if (page_count(page) > 0)
> > -					__put_page(page);
> > -			}
> > -		}
> > -	}
> > -}
> 
> What on earth is the above trying to do?  The inner loop is a rather
> complex way of doing atomic_add(&page->count, sg->length/PAGE_SIZE).  One
> suspects there's a missing "[m]" in there.
> 

It does this on the first mmap of the device, in the hope that subsequent
nopage, unmaps would not free the constituent pages in the scatterlist.

> Yes, using a compound page for the refcounting sounds sane, but I think
> this code is fragile and has monsters in it.


-
: 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