"Zi Yan" <ziy@xxxxxxxxxx> writes: > On 13 Apr 2021, at 23:00, Huang, Ying wrote: > >> Yang Shi <shy828301@xxxxxxxxx> writes: >> >>> The generic migration path will check refcount, so no need check refcount here. >>> But the old code actually prevents from migrating shared THP (mapped by multiple >>> processes), so bail out early if mapcount is > 1 to keep the behavior. >> >> What prevents us from migrating shared THP? If no, why not just remove >> the old refcount checking? > > If two or more processes are in different NUMA nodes, a THP shared by them can be > migrated back and forth between NUMA nodes, which is quite costly. Unless we have > a better way of figuring out a good location for such pages to reduce the number > of migration, it might be better not to move them, right? > Some mechanism has been provided in should_numa_migrate_memory() to identify the shared pages from the private pages. Do you find it doesn't work well in some situations? The multiple threads in one process which run on different NUMA nodes may share pages too. So it isn't a good solution to exclude pages shared by multiple processes. Best Regards, Huang, Ying