All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Ray Bryant <raybry@sgi.com>
Cc: Hirokazu Takahashi <taka@valinux.co.jp>, linux-mm@kvack.org
Subject: Re: migration cache bug?
Date: Thu, 10 Feb 2005 14:41:47 -0200	[thread overview]
Message-ID: <20050210164147.GA19877@logos.cnet> (raw)
In-Reply-To: <420BB9E6.90303@sgi.com>

Hi Ray, 

On Thu, Feb 10, 2005 at 01:45:42PM -0600, Ray Bryant wrote:
> (Resending so this gets posted to linux-mm):
> 
> Hirokazu and Marcello,
> 
> Here's some more information on this problem I am having with the
> migration cache.
> 
> (The problem is that the test application is failing after it returns
> from the system call that migrated some of its address space from node
> 0 to node 3 on my test box.  When the program touches the first page
> in the range that was migrated, the process gets killed because
> do_swap_page() returns VM_FAULT_OOM.  The test works fine if I remove
> the migration cache patch.)

Thing is the PTE should have been remapped by touch_unmapped_address() at
the end of generic_migrate_page() during the migration syscall.

Hirokazu implemented the set of changes which saves mm_struct,address pairs of corresponding
page mappings on a list of "page_va_list" structures:

struct page_va_list {
        struct mm_struct *mm;
        unsigned long addr;
        struct list_head list;
};

To later on be able to redo the mapping (touch_unmapped_address).

generic_migrate_pages() {
	LIST_HEAD(vlist);
...
	if (page_mapped(page)) {
                while ((ret = try_to_unmap(page, &vlist)) == SWAP_AGAIN)
                        msleep(1);
                if (ret != SWAP_SUCCESS) {
                        ret = -EBUSY;
                        goto out_busy;
                }
        }
...
        /* map the newpage where the old page have been mapped. */
        touch_unmapped_address(&vlist);
	if (PageMigration(newpage))
		detach_from_migration_cache(newpage);       <---- comment it out to confirm
	else if (PageSwapCache(newpage)) {
		lock_page(newpage);
		__remove_exclusive_swap_page(newpage, 1);
		unlock_page(newpage);
        }
}

Can you find you why is touch_unmapped_address() failing to work? 

To confirm this hypothesis, please comment the call to "detach_from_migration_cache(newpage)"
at the end of generic_migrate_pages().

This should cause lookup_migration_cache() to succeed and remap the pte.

Hope that helps.

> It looks like the page is flagged as being a migration pte, the page
> is found in the migration cache, but then the test
> 
>            "likely(pte_same(*page_table, orig_pte))"
> 
> succeeds.  It's not obvious to me, at the moment, what this is supposed
> to be doing.
> 
> Here is the code segment from do_swap_page(), with the debug printout
> that was triggered:
> 
> again:
>         if (pte_is_migration(orig_pte)) {
>                 page = lookup_migration_cache(entry.val);
>                 if (!page) {
>                         spin_lock(&mm->page_table_lock);
>                         page_table = pte_offset_map(pmd, address);
>                         if (likely(pte_same(*page_table, orig_pte))) {
> ==========================>     DEBUG_VM_KILL(address);
>                                 ret = VM_FAULT_OOM;
>                         }
>                         else
>                                 ret = VM_FAULT_MINOR;
>                         pte_unmap(page_table);
>                         spin_unlock(&mm->page_table_lock);
>                         goto out;
>                 }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2005-02-10 16:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-10 19:45 migration cache bug? Ray Bryant
2005-02-10 16:41 ` Marcelo Tosatti [this message]
2005-02-11  6:25   ` Ray Bryant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050210164147.GA19877@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=linux-mm@kvack.org \
    --cc=raybry@sgi.com \
    --cc=taka@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.