Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4816290imm; Mon, 11 Jun 2018 20:17:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKMtfwgmCTzLWbb5on5hUwT4R8KZKBFiz7TAJduUurZoEmBt6k0ClvKSw1Ku+oQOJpKDLAU X-Received: by 2002:a65:5bce:: with SMTP id o14-v6mr1555950pgr.449.1528773475217; Mon, 11 Jun 2018 20:17:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528773475; cv=none; d=google.com; s=arc-20160816; b=j3sE6WX6yvewb36XzRi9FGnT+KkyckZ9XAGe1tL+y4s3ffn7hzbF17fh9BNXts9dio S9XVWphOnlypHSOeKOvCbIad2tV9PKW9Y1D6pWSk0PVmx4rxOX+QxFo7qnSyqmOyy4LL miLAS2OKolR8kB36WKYGDpQe7Goirt2otLTmpP3BPRs1kPZVjff/IOtuoz2TnY3d3RNx mG05Ak0kDz9Smu+C7rlNrWLkEHy7OgJR6rxUNQqcsPwZtpMmW2AoR/VA8dd1w5jGZ4jr gYENIrc/11Yub2GMKENyAbgff28RXSyJzFMMT35TF+ZuPv7Yeb1X5SxD/FWelpLajckI xc7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=amZxm5a5FkOWKXsWSHgwAoi4pea5K7O0hW/Lxjwo2WA=; b=J0PXaVf7GvT7xp9GTfJwVRgzAv1g8i/63dgG70n3bPQRf9+C9+cgQBoq1UiDR3ogT/ NTbbqlFVZfOwljCFgLl3dI7dmi0K1EVGYW4D0vTi02VJ6MCWqrbochN24kYW+9zkKjN/ P5cHVzAbvFKbk83WmuTynthwrJZQsjMQ4hX/sN7OMXhf3TNapw69w73G0UG5Jr15f36/ Sg8/tdS2reEC9Hsn1hv4JlAAEizQNXo7JN9PszlCQzOyW8Rl3mJg0TbrDuMnu2RRBEc5 cvrOXHftiw2D5lHVk2KIcG9GzrHC5wnLkMur38uK0PZ6ejIGcJjFVLoeMkbAX6eqIu/N GBKw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13-v6si1466970pgs.661.2018.06.11.20.17.40; Mon, 11 Jun 2018 20:17:55 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754053AbeFLDPf (ORCPT + 99 others); Mon, 11 Jun 2018 23:15:35 -0400 Received: from mga14.intel.com ([192.55.52.115]:31608 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbeFLDPc (ORCPT ); Mon, 11 Jun 2018 23:15:32 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jun 2018 20:15:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,213,1526367600"; d="scan'208";a="66239368" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.13.118]) by orsmga002.jf.intel.com with ESMTP; 11 Jun 2018 20:15:29 -0700 From: "Huang\, Ying" To: Daniel Jordan Cc: Andrew Morton , , , "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() 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> Date: Tue, 12 Jun 2018 11:15:28 +0800 In-Reply-To: <87o9ggpzlk.fsf@yhuang-dev.intel.com> (Ying Huang's message of "Tue, 12 Jun 2018 09:23:19 +0800") Message-ID: <87k1r4puen.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "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. Best Regards, Huang, Ying