lkml.org 
[lkml]   [2018]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH -mm -v4 05/21] mm, THP, swap: Support PMD swap mapping in free_swap_and_cache()/swap_free()
Date
Daniel Jordan <daniel.m.jordan@oracle.com> writes:

> On Fri, Jun 22, 2018 at 11:51:35AM +0800, Huang, Ying wrote:
>> +static unsigned char swap_free_cluster(struct swap_info_struct *si,
>> + swp_entry_t entry)
> ...
>> + /* Cluster has been split, free each swap entries in cluster */
>> + if (!cluster_is_huge(ci)) {
>> + unlock_cluster(ci);
>> + for (i = 0; i < SWAPFILE_CLUSTER; i++, entry.val++) {
>> + if (!__swap_entry_free(si, entry, 1)) {
>> + free_entries++;
>> + free_swap_slot(entry);
>> + }
>> + }
>
> Is is better on average to use __swap_entry_free_locked instead of
> __swap_entry_free here? I'm not sure myself, just asking.
>
> As it's written, if the cluster's been split, we always take and drop the
> cluster lock 512 times, but if we don't expect to call free_swap_slot that
> often, then we could just drop and retake the cluster lock inside the innermost
> 'if' against the possibility that free_swap_slot eventually makes us take the
> cluster lock again.

Yes. This is a good idea. Thanks for your suggestion! I will change
this in the next version.

Best Regards,
Huang, Ying

> ...
>> + return !(free_entries == SWAPFILE_CLUSTER);
>
> return free_entries != SWAPFILE_CLUSTER;

\
 
 \ /
  Last update: 2018-07-06 14:49    [W:0.138 / U:3.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site