Re: [PATCH 5/5] Swapless V2: Revise main migration logic

From: KAMEZAWA Hiroyuki
Date: Mon Apr 17 2006 - 20:03:16 EST


On Mon, 17 Apr 2006 10:00:02 -0700 (PDT)
Christoph Lameter <clameter@xxxxxxx> wrote:

> On Mon, 17 Apr 2006, KAMEZAWA Hiroyuki wrote:
>
> > > Note that there is an issue with your approach. If a migration entry is
> > > copied during fork then SWP_MIGRATION_WRITE must become SWP_MIGRATION_READ
> > > for some cases. Would you look into fixing this?
> > Thank you for pointing out the issue.
> >
> > In my understanding, copy_page_range() is used at fork().
> > This finally calls copy_one_pte() and copies ptes one by one.
>
> Right this is one spot but the ptes in the original mm must also be marked
> read. Are there any additional races?
>
Ah, yes. you are right.


> > Maybe, I'll do like this.
> > ==
> > 438 if (unlikely(!pte_present(pte)) {
> > 439 if (!pte_file(pte)) {
> > 440 swap_duplicate(pte_to_swp_entry(pte));
> > entry = pte_to_swp_entry(pte);
> > #ifdef CONFIG_MIGRATION
> > if (is_migration_entry(entry)) {
> > ......always copy as MIGRATION_READ.
> > }
> > #endif
> > 441 /* make sure dst_mm is on swapoff's mmlist. */
>
> Looks okay for this one location.
>
Then,

if (is_migration_entry(entry)) {
change_to_read_migration_entry(entry);
copy_entry(entry);
}

is sane.

-Kame




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