[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCHv6 3/3] xen/privcmd: improve performance of MMAPBATCH_V2
On 09/03/15 12:25, Stefano Stabellini wrote: > On Fri, 6 Mar 2015, David Vrabel wrote: >> >> +/* >> + * Similar to traverse_pages, but use each page as a "block" of >> + * data to be processed as one unit. >> + */ >> +static int traverse_pages_block(unsigned nelem, size_t size, >> + struct list_head *pos, >> + int (*fn)(void *data, int nr, void *state), >> + void *state) >> +{ >> + void *pagedata; >> + unsigned pageidx; >> + int ret = 0; >> + >> + BUG_ON(size > PAGE_SIZE); > > I looks like that PAGE_SIZE needs to be a multiple of size. Maybe we can > add a BUG_ON for that too. There is no such requirement because... >> + pageidx = PAGE_SIZE; >> + >> + while (nelem) { >> + int nr = (PAGE_SIZE/size); ...the number of elements per pages is rounded down here. >> + struct page *page; >> + if (nr > nelem) >> + nr = nelem; >> + pos = pos->next; >> + page = list_entry(pos, struct page, lru); >> + pagedata = page_address(page); >> + ret = (*fn)(pagedata, nr, state); >> + if (ret) >> + break; >> + nelem -= nr; >> + } >> + >> + return ret; >> +} David _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |