On 02/23/2017 02:24 PM, Naoya Horiguchi wrote: > On Fri, Feb 17, 2017 at 10:05:44AM -0500, Zi Yan wrote: >> From: Zi Yan <ziy@xxxxxxxxxx> >> >> It supports copying a list of pages via multi-threaded process. >> It evenly distributes a list of pages to a group of threads and >> uses the same subroutine as copy_page_mthread() > The new function has many duplicate lines with copy_page_mthread(), > so please consider factoring out them into a common routine. > That makes your code more readable/maintainable. Though it looks very similar to each other. There are some subtle differences which makes it harder to factor them out in common functions. int copy_pages_mthread(struct page *to, struct page *from, int nr_pages) * This takes a single source page and single destination page and copies contiguous address data between these two pages. The size of the copy can be a single page for normal page or it can be multi pages if its a huge page. * The work is split into PAGE_SIZE * nr_pages / threads and assigned to individual threads which is decided based on number of CPUs present on the target node. A single thread takes a single work queue job and executes it. int copy_page_list_mt(struct page **to, struct page **from, int nr_pages) * This takes multiple source pages and multiple destination pages and copies contiguous address data between two pages in a single work queue job. The size of the copy is decided based on type of page whether normal or huge. * Each job does a single copy of a source page to destination page and we create as many jobs as number of pages though they are assigned to number of thread based on the number of CPUs present on the destination node. So one CPU can get more than one page copy job scheduled. - Anshuman -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>