[lkml]   [2018]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH -mm -v4 14/21] mm, cgroup, THP, swap: Support to move swap account for PMD swap mapping
Daniel Jordan <> writes:

> On Fri, Jun 22, 2018 at 11:51:44AM +0800, Huang, Ying wrote:
>> Because there is no way to prevent a huge swap cluster from being
>> split except when it has SWAP_HAS_CACHE flag set.
> What about making get_mctgt_type_thp take the cluster lock? That function
> would be the first lock_cluster user outside of swapfile.c, but it would
> serialize with split_swap_cluster.
>> It is possible for
>> the huge swap cluster to be split and the charge for the swap slots
>> inside to be changed, after we check the PMD swap mapping and the huge
>> swap cluster before we commit the charge moving. But the race window
>> is so small, that we will just ignore the race.
> Moving the charges is a slow path, so can't we just be correct here and not
> leak?

Check the code and thought about this again, found the race may not
exist. Because the PMD is locked when get_mctgt_type_thp() is called
until charge is completed for the PMD. So the charge of the huge swap
cluster cannot be changed at the same time even if the huge swap cluster
is split by other processes. Right?

Will update the comments for this.

Best Regards,
Huang, Ying

 \ /
  Last update: 2018-07-10 09:50    [W:0.114 / U:4.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site