On Wed, Aug 12, 2020 at 07:41:41PM +0100, Matthew Wilcox wrote: > On Wed, Aug 12, 2020 at 06:30:59PM +0300, Andy Shevchenko wrote: > > while (!list_empty(&pool->page_list)) { > > struct dma_page *page; > > - page = list_entry(pool->page_list.next, > > - struct dma_page, page_list); > > + > > + page = list_first_entry(&pool->page_list, struct dma_page, page_list); > > Eh, I'd rather see this as: > > struct dma_page *page = list_first_entry(&pool->page_list, > struct dma_page, page_list); On the second thought we may convert the entire loop to use list_for_each_entry_safe() since there is no locking in between, we should be fine. -- With Best Regards, Andy Shevchenko