Hi, Marcelo> > > 2) > > > At migrate_onepage you add anonymous pages which aren't swap allocated> > > to the swap cache> > > + /*> > > + * Put the page in a radix tree if it isn't in the tree yet.> > > + */> > > +#ifdef CONFIG_SWAP> > > + if (PageAnon(page) && !PageSwapCache(page))> > > + if (!add_to_swap(page, GFP_KERNEL)) {> > > + unlock_page(page);> > > + return ERR_PTR(-ENOSPC);> > > + }> > > +#endif /* CONFIG_SWAP */> > > > > >that it doesn't allow the migration code blocked. the semaphoreapproach would be better.I have another idea that each anonymous page can detach its swap entryafter its migration. It can be done by remove_exclusive_swap_page()if the page is remapped to the same spaces forcibly bytouch_unmapped_address() I made.> >migration code or just use migrate_page_buffer() ormigrate_page_common(). migrate_page_common() is a default function if filesystem doesn'timplement anything. The function is the most generic and it triesto writeback pages only if they are dirty and have buffers.> > or> > just to wait for a while since the page is just referred by system call > > or pagefault handler.> > I'm not sure if making that assumption is always valid.> > Kernel code can have an additional count on the page meaning "this page is pinned, > dont move it". At least that should be valid.Yes, I know. I have checked all of the code.AIO event buffers are pinned, therefore the memory-hotplug team plansto make pages for the event buffers assigned to non-hotpluggablememory regions.And pages in sendfile() might be pinned for a while in case of networkproblems. I think there may be some workarounds. The easiest wayis just waiting its timeout, and another way is changing the modeof sendfile() to copy pages in advance. Pages for NFS also might be pinned with network problems.One of the ideas is to restrict NFS to allocate pages fromspecific memory region, sot that all memory except the regioncan be hot-removed. And it's possible to implementing wholemigrate_page method, which may handled stuck pages.If the migration code is used for memory defragmentation, pinned pagesmust be avoided. I think it can be done with the non-blocking mode.> Any piece of code which holds a reference on a page for a long > time is going to be a pain for the algorithm right?> > > > 4) > > > About implementing a nonblocking version of it. The easier way, it> > > seems to me, is to pass a "block" argument to generic_migrate_page() and> > > use that.> > > > Yes.> > OK. I'll try to implement it this week (plus the radix_tree_replace > tag thingie).Thank you for that.Hirokazu Takahashi.-To unsubscribe from this list: send the line "unsubscribe linux-kernel" inthe body of a message to majordomo@vger.kernel.orgMore majordomo info at read the FAQ at