Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1595728ybj; Wed, 6 May 2020 01:24:50 -0700 (PDT) X-Google-Smtp-Source: APiQypKOLIYDHZqVB2xA5f7t2NL1XbHhT61KSMiQTpdiDqUARq1sj9pdF/TaDc4EmavWopi84Hin X-Received: by 2002:aa7:cc88:: with SMTP id p8mr5796791edt.387.1588753490323; Wed, 06 May 2020 01:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588753490; cv=none; d=google.com; s=arc-20160816; b=bpDiRMD+VZsZi8QRUseK7yHbAHhFMa72F0il3rwjoIFmJ1lkuoZgzqXPY+DC+cciyz 7VSjbg9W4aCHafbYEQaoL1nfluri1W9RA41G3vYhwTchyAEsM96L3F1j0T3tLJrf2Jlg BHjG02Gk5EsuRrRqet5DoO9mUC5plLHS9Tgv10XQYqU5GCsmGtRHb2+CvBlrzbBLkdjP ewFauwwI/I6QlocgSXjf/XM3w011C7YndOLPJBqkGGwWhgoWrwydn4fEHfK2kn2qH4+F 9rkSdDUouK9MOWyzKzdGY+2wcesysR8NL37oRtOISP00bUewW4lOVYW+latgu48KTOOT iSEw== 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:ironport-sdr :ironport-sdr; bh=VmO9STQqLfa5lp+QzgdJo59Ffwz/HSKU7qV06HUsSiU=; b=jl8cLegJRelOTcaGJidkSyLpxa+5LNzCrJQOflyfYUe511sjACvt6EtUPrCJKBFUu7 5sPwywRfJFP5N0Tl8aU814+oYmscEmJWJCRiYv4BFklQfzuJJUP9EySHr+o1Y4aMle1C LFnAaalnyp7IxZok/RxAhpii0Z3DczJG50mgdpdONTblsfGJyVADTVGKmXQ+r3+tJYEQ xFZLC/gezGbdDh9fG7P0ZjscS6X9G2/5N8xy64oL0gIsT3HQ9EegUmok0pOrcNTW4ToV O8Hd1FDRHxQzjooFt6Wbde0t56FHDoAkQuHsE0ebX0LfuSrgqNf801Yxw484XDHGWYF/ HK2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id o23si755404ejd.302.2020.05.06.01.24.27; Wed, 06 May 2020 01:24:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728708AbgEFIW6 (ORCPT + 99 others); Wed, 6 May 2020 04:22:58 -0400 Received: from mga14.intel.com ([192.55.52.115]:19981 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728573AbgEFIW6 (ORCPT ); Wed, 6 May 2020 04:22:58 -0400 IronPort-SDR: 3Ako+PfXdeFEIKKuckXNebe1S4pUGL0UU9lkAPZrryEyktDLWvkjXJE+WyWDTDalvQbQeVxpda f5C2kzuZ16kw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2020 01:22:57 -0700 IronPort-SDR: zzl/daXJ0Oc7LgXfevtb/pXR40XCMnV3NryHB9opA31ZugUP9uNZBg7KMhVaAbYy82E8S3ZdAx 7m7bWACakU1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,358,1583222400"; d="scan'208";a="461682447" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by fmsmga006.fm.intel.com with ESMTP; 06 May 2020 01:22:55 -0700 From: "Huang\, Ying" To: Wei Yang Cc: Andrew Morton , , Subject: Re: [PATCH 3/3] mm/swapfile.c: count won't be bigger than SWAP_MAP_MAX References: <20200501015259.32237-1-richard.weiyang@gmail.com> <20200501015259.32237-3-richard.weiyang@gmail.com> <20200501154853.bca4cfb7b2558bd43a4942f3@linux-foundation.org> <20200502132911.u6y6hkh56ik4ojne@master> Date: Wed, 06 May 2020 16:22:54 +0800 In-Reply-To: <20200502132911.u6y6hkh56ik4ojne@master> (Wei Yang's message of "Sat, 2 May 2020 13:29:11 +0000") Message-ID: <87k11pv5ep.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (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 Wei Yang writes: > On Fri, May 01, 2020 at 03:48:53PM -0700, Andrew Morton wrote: >>On Fri, 1 May 2020 01:52:59 +0000 Wei Yang wrote: >> >>> When the condition is true, there are two possibilities: >> >>I'm struggling with this one. >> >>> 1. count == SWAP_MAP_BAD >>> 2. count == (SWAP_MAP_MAX & COUNT_CONTINUED) == SWAP_MAP_SHMEM >> >>I'm not sure what 2. is trying to say. For a start, (SWAP_MAP_MAX & >>COUNT_CONTINUED) is zero. I guess it meant "|"? > > Oops, you are right. It should be (SWAP_MAP_MAX | COUNT_CONTINUED). > > Sorry for the confusion. > >> >>Also, the return value documentation says we return EINVAL for migration >>entries. Where's that happening, or is the comment out of date? >> > > Not paid attention to this. > > Take look into the code, I don't find a relationship between the swap count > and migration. Seems we just make a migration entry but not duplicate it. > If my understanding is correct. Per my understanding, one functionality of the error path is to catch the behavior that shouldn't happen at all. For example, if __swap_duplicate() is called for the migration entry because of some race condition. Best Regards, Huang, Ying