Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5248503imm; Tue, 12 Jun 2018 05:08:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJCmKv6nbpqgdFx9GvsiG0qzE+3Az/z45lws+3GFweeV9KYWSIfagNcNqDfNzjterDVBX+x X-Received: by 2002:a63:a513:: with SMTP id n19-v6mr41202pgf.381.1528805290076; Tue, 12 Jun 2018 05:08:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528805290; cv=none; d=google.com; s=arc-20160816; b=dysMVsUwXl6uj9lOoW6onDt5Xy4VLuW6NAcummWiNdp0H3tth7Uy40OI2URw0JL4Ei VExNCLOPgFZYykZkQYY7bK1bqaJjvjC64bsFK4ETDQMgAGJe9I7XoMYz1IAWgM3Ixu+C vTVKw9/H2tqZYAcc0ZOvlf9CaLL/DuQwl93AcmppkqhNrYp+t/voe2t0fI44U+v9weDz RtNdC84Q0cQQzErFLPDKrgN0XrIOwuMOGUatNVbVfPkdm9VBuNNkL50hP6KD3pZdmMLW NasPneBw8SXyol5IqrKlgdVxG3kpUXjcyhwaA1dUkrcdDa2ukCSPfNJFYQ9nPPECOBnP UUCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=6poXulIUtzztQ5grNIfag9zQknDDPzpU3plil3fEJGU=; b=YZGwmMQdoPDqEkEdAlmXDkFd02MqDWQ5xXXa95xL9lu2/f8A/7l6Q4bht6BX/kE6Rk Mh+RmL2p2mGNaPc3b3zlJHHir1adblvc38UWBYKuGNwBlfbG1wKI7iRy28/vXn9Pi/dx XuB7NfpHKfOfM7Xi+ytPdfG7c/Xq+oSMEpdkvt1qcKVlRhosb//4KlYU/dfA8B4XgLN3 mG5sQf+pSjAc9LTLEqD1ga53zlhMA+y2tHnuEzh0aawfhJoztvIbf2SlfB0P3blaZqFY FqhxvBTvxFVJZALfqe0Sb7Kg4dCDq5w49s7vRvAo7jwESluxioRBrW36yHxRruhBUUPZ 7fOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SV+GkUPW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2-v6si1825ple.192.2018.06.12.05.07.55; Tue, 12 Jun 2018 05:08:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=SV+GkUPW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933467AbeFLMGS (ORCPT + 99 others); Tue, 12 Jun 2018 08:06:18 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:35066 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932412AbeFLMGR (ORCPT ); Tue, 12 Jun 2018 08:06:17 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w5CC5l1R146193; Tue, 12 Jun 2018 12:05:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=6poXulIUtzztQ5grNIfag9zQknDDPzpU3plil3fEJGU=; b=SV+GkUPWIJvozZhMIlwOjKY0+EBPbpHtINyfslaD2iJllMrMBtw1kuJab8VGjZKuxAmU dtFNSFdkKY/B18rBNlnNAM2ZjIBexJm0pScOzMhz4KFCDMf/RUrEYiOTwBKA1qu0B1R7 6gND602ZO9gXhhlWhfcOzr6vUUQv1OPOUedjqlakenc03AtEbr+hvDGQZUYBHmJvaAUM N3A436yV4gxQDG4yEGZq+VeBcnnC6WSnEcjD1joHVSBCdE5+5tU5oPAIq1wQeUzubjAB 9KZCbOP+T/ruZFoWyYGBDuOwCxf3Q0J9y2CyLhKR6CnBTFqwcMNO5XxK+O2tDYCsO6Nn 7w== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2jg4dm1vv2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Jun 2018 12:05:51 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w5CC5oH9024345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Jun 2018 12:05:50 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w5CC5n7N004307; Tue, 12 Jun 2018 12:05:49 GMT Received: from ca-dmjordan1.us.oracle.com (/10.211.9.48) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 12 Jun 2018 05:05:49 -0700 Date: Tue, 12 Jun 2018 05:05:47 -0700 From: Daniel Jordan To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Andrea Arcangeli , Michal Hocko , Johannes Weiner , Shaohua Li , Hugh Dickins , Minchan Kim , Rik van Riel , Dave Hansen , Naoya Horiguchi , Zi Yan Subject: Re: [PATCH -mm -V3 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate() Message-ID: <20180612120547.njpz73dymeru5mzy@ca-dmjordan1.us.oracle.com> References: <20180523082625.6897-1-ying.huang@intel.com> <20180523082625.6897-4-ying.huang@intel.com> <20180611204231.ojhlyrbmda6pouxb@ca-dmjordan1.us.oracle.com> <87o9ggpzlk.fsf@yhuang-dev.intel.com> <87k1r4puen.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k1r4puen.fsf@yhuang-dev.intel.com> User-Agent: NeoMutt/20180323-268-5a959c X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8921 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806120142 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 12, 2018 at 11:15:28AM +0800, Huang, Ying wrote: > "Huang, Ying" 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. Fair enough, I'll see about adding this along with the other patch I'm sending. Daniel