lkml.org 
[lkml]   [2018]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH -mm -V3 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()
Date
"Huang, Ying" <ying.huang@intel.com> writes:
>> On Wed, May 23, 2018 at 04:26:07PM +0800, Huang, Ying wrote:
>>> @@ -3516,11 +3512,39 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage)
>>
>> Two comments about this part of __swap_duplicate as long as you're moving it to
>> another function:
>>
>> } else if (count || has_cache) {
>>
>> if ((count & ~COUNT_CONTINUED) < SWAP_MAP_MAX) /* #1 */
>> count += usage;
>> else if ((count & ~COUNT_CONTINUED) > SWAP_MAP_MAX) /* #2 */
>> err = -EINVAL;
>>
>> #1: __swap_duplicate_locked might use
>>
>> VM_BUG_ON(usage != SWAP_HAS_CACHE && usage != 1);
>>
>> to document the unstated assumption that usage is 1 (otherwise count could
>> overflow).
>
> Sounds good. Will do this.

Found usage parameter of __swap_duplicate() could be SWAP_MAP_SHMEM too.
We can improve the parameter checking. But that appears not belong to
this series.

Best Regards,
Huang, Ying

\
 
 \ /
  Last update: 2018-06-12 05:16    [W:0.129 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site