working of migrate_page (exported) function in mm/migrate.c linux Kernel
Hi, Anybody knows the working of this function "migrate_page" (not "migrate_pages") defined in mm/migrate.c file (linux 2.6) This function is exported so can be used in a Kernel module. Is it used somewhere ? Can it be used to migrate a page to a different NUMA node from kernel module and How to use it? Is there a function/way in kernel which can be used to migrate page to different NUMA node from Kernel module (not userspace)? Ajay
On Mon, 23 Sep 2013 09:00:21 +0800, ajay saini said:
Is it used somewhere ?
[~] cd /usr/src/linux-next/ [/usr/src/linux-next] find [a-z]* -name '*.[ch]' | xargs grep migrate_page | grep -v migrate_pages And start searching from there. You'll probably have to iterate several times, because there's at least onea few lines of the form: mm/swap_state.c: .migratepage = migrate_page, mm/shmem.c: .migratepage = migrate_page, which means you need to figure out who calls that function pointer.
Hi, I have read some of these uses (of migrate_page) from linux kernel source code and tried to use this function in my kernel module. But it somehow hangs my module. Linux version : 2.6 and system has 4 NUMA nodes (0-3) and has 16 cores in total. I have done following: ( I already have a pointer to old page as pg ) [ this code is somewhat taken from usage of "migrate_page" in mm/migrate.c file ] -------------------------------------------------------- struct page *new_page = alloc_pages_exact_node(2,GFP_HIGHUSER_MOVABLE | GFP_THISNODE, 0); if ( new_page != NULL ) { if ( trylock_page(new_page) ) { new_page->index = pg->index; new_page->mapping = pg->mapping; struct address_space *mapping = pg->mapping; migrate_page(mapping, new_page, pg); unlock_page(new_page); } } -------------------------------------------------------- - I have checked without locking also, but it does not work - I check the existence of both pages and on what NUMA node they are assigned and it gives me correct information. It is only when I make a call to migrate_page does the code hangs. Any ideas? Ajay ________________________________ From: "Valdis.Kletnieks@vt.edu" <Valdis.Kletnieks@vt.edu> To: ajay saini <ajay_saini1006@yahoo.co.in> Cc: "kernelnewbies@kernelnewbies.org" <kernelnewbies@kernelnewbies.org> Sent: Sunday, 22 September 2013 9:53 PM Subject: Re: working of migrate_page (exported) function in mm/migrate.c linux Kernel On Mon, 23 Sep 2013 09:00:21 +0800, ajay saini said:
Is it used somewhere ?
[~] cd /usr/src/linux-next/ [/usr/src/linux-next] find [a-z]* -name '*.[ch]' | xargs grep migrate_page | grep -v migrate_pages And start searching from there. You'll probably have to iterate several times, because there's at least onea few lines of the form: mm/swap_state.c: .migratepage = migrate_page, mm/shmem.c: .migratepage = migrate_page, which means you need to figure out who calls that function pointer. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (2)
-
ajay saini -
Valdis.Kletnieks@vt.edu