lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Sat, 10 Mar 2007 22:16:31 +0100
From:	Michal Hocko <mstsxfx@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: mm: migrate_pages using

Hello.

I have some problems with migrate_pages understanding. Here is my
situation:
I need to change virtual page mapping (all stuff referring to the page) 
to new physical location. Page is present for the process and new page is 
already allocated (and not mapped anywhere). I thought that direct migration 
code should help me, but there are some issues. Maybe I am missing something.

Here is my simple wrapper for migrate_pages (and related) function:

struct page * return_target(struct page * page, unsigned long private,
        int ** result)
{
        return (struct page *)private;
}

/* I am keeping non exclusive mmap_sem when entering and leaving */
int migrate_pfn_page(struct page *original, struct page *target)
{
        LIST_HEAD(pagelist);
        int ret;

        if((ret = migrate_prep()))
                goto done;
        get_page(original);
        ret = isolate_lru_page(original, &page_list);
        put_page(original);
        if(ret)
                goto done;
        ret = migrate_pages(&page_list, return_target, (unsigned long)target);
done:
        return ret;
}

I think that I am loosing pages this way (reference count is not
decreased properly and so original page doesn't get to the free list).
As a example (from printk output):
* before function starts.
original: flags:0x00000060 mapping:dece8fa1 mapcount:1 count:1
target: flags:0x00000000 mapping:00000000 mapcount:0 count:1
* before migrate_pages is called
original flags:0x00000040 mapping:dece8fa1 mapcount:1 count:2
target flags:0x00000000 mapping:00000000 mapcount:0 count:1
* migrate_pages returns with 0 and
original flags:0x00000000 mapping:00000000 mapcount:0 count:1
target flags:0x00000010 mapping:dece8fa1 mapcount:1 count:2

When I try to put_page(original) (because I don't want it for this
moment) I get to bad_page path and need to reboot...

What am I missing? Am I using migrate_pages correctly?

Thanks for any suggestions.

(please add me to cc: because I am not list member)

P.S.
I am using vanilla 2.6.18 source tree.

Best regards
-- 
Michal Hocko

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ