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@xxxxxx" <Valdis.Kletnieks@xxxxxx>
To: ajay saini <ajay_saini1006@xxxxxxxxxxx>
Cc: "kernelnewbies@xxxxxxxxxxxxxxxxx" <kernelnewbies@xxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies