Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp72591ybk; Fri, 8 May 2020 14:21:54 -0700 (PDT) X-Google-Smtp-Source: APiQypJWYoBSOTxE/28qAbREU3apz27dc7+7ItPUEpMuOfeb5HNz14cUjIrTULq0wZKZB1u/5y0H X-Received: by 2002:a05:6402:70c:: with SMTP id w12mr3759265edx.377.1588972913764; Fri, 08 May 2020 14:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588972913; cv=none; d=google.com; s=arc-20160816; b=Ermy1W6el9VnCxf9hBFixS+8ikdz5f0RnXTGiQifJHOY/aXBmDnxoqmVwZ3M3CCv1t SLW0fA9bHbfvTOcYkDh5yM5S/ruhJHpKzqSJLIiJ1YmmJtjyacopHQ2TLxH1Lh+z1EKW 2fnLBHoh2JAmCJmgMVTRVxvND41NnwlP1n8qzeF1gK+iO2jSRvageZGyK5zUdgF9TFYw 5uKejeygIzMMrVbO6iFRYmBsBKP0Tf9vF0Pm6+dg3VLS35xDhNOW61mKsdsvSjpI5MJf IMhOm2kO3jh4cBLlzlNtRP4Kq1rTppCSSJubM0AUsrt5spBL49aL3+6Jrx5sjKOzxCoj F6Lg== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=MfGO3pjQpz1FBRiqCb0+KptNcnlzs41SYOqSqBBspK8=; b=NgDDOlShKe8hcXzMSDwU3UTSapyxguFX8U4WUU1PI97ziwUvkwvXYjq7vv1TEQiM2y 91KO0dRailE0daXbpRb+TPjLCwuZ0NYr6/r2aBPn2FG91xQ/uihgH9DHc9z3zfzX1Oxz AbiitiVmkx3tHezGlAfnjJ9aSVbUQwvjsPKOi8ytyS4brKU8S6r3F6BM0/ujjeM0MQ+7 zzCOPGrpafo0ezDnYMqqO91rC1dalcfjOKr44v8EOXnX1kRN++xC8wTaOWkTzh8KQQVR UKh6bI0/scUc/FW5joK8rom37g/gfrnrYPfrGOM2LRXz3Do09S/1STFYFlGRieGXOm+Y 9zRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oosTixpZ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si1648695edx.606.2020.05.08.14.21.30; Fri, 08 May 2020 14:21:53 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oosTixpZ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727890AbgEHVUD (ORCPT + 99 others); Fri, 8 May 2020 17:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726950AbgEHVUB (ORCPT ); Fri, 8 May 2020 17:20:01 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6678AC05BD43 for ; Fri, 8 May 2020 14:20:01 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id j5so3563683wrq.2 for ; Fri, 08 May 2020 14:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=MfGO3pjQpz1FBRiqCb0+KptNcnlzs41SYOqSqBBspK8=; b=oosTixpZ3ZazMDUIgl65wMlu5Yu9BNLoLL9U6epBBWcKc/5DCtc9hxB84eEYGju6IR KUzI1CaESJWKx9QPhjL+L0sMKs2Z0qCfBVL0foEbAKx9gxcU8DdZ7dtoeljayPAlA/AI loye5aZqDYIor3pIL8TMWJU/2gqphzvv4s1oBem51L1WEQqlKN7YREis4K5k1s33twMc GTA1EtoNFXCjSCCbCCyHgRE6j04kOvf7s427dNTdcPyEbvX+899yvSY3mXKp1BhkfX0z y7kFdyBMSLY3AjWshZYSiUjzTB/yI4Rzs3vbY7OsJovZpJOePjZnk0yJ3XdLq0TpLzES SFDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=MfGO3pjQpz1FBRiqCb0+KptNcnlzs41SYOqSqBBspK8=; b=MdL/UbFgVyk6RaI2QNGgo7mtsrRnO3rF/F9k0h+/7d+JIvYJo5SUYcveixBi20/fp2 GhewJBaE8hIGSecJgnBaIvZdSPFEt0BU1ZykXWMOlhBhTVATvWqqSuvW7smptMIhbr6Z nPfbGvwfIeudioJTgLccTC4fDVXlmvdFJg4ia0n3PBXKWTjkNzezuoNLqMrzD1fN9no2 F9CX9hP5i1B5j8a9ipE+Uiz2pi+PpbOoO3tGvtR0EoNUv14/OHrRWPUAZgmS64fgOrA4 GHnMM3mwBZUWT7MAQKk/pX7zW5gN/0mNk80w73WOct2FUFxy7RlEg2zIiAR2oTZza6Pj EZBQ== X-Gm-Message-State: AGi0PuboscXmhTWkS4jaYi6uPsO5G/I9VY+dybmBAO2NMXC78XCIM3JV aNiGUwAq9tgfioRERE5Cxck= X-Received: by 2002:a5d:6108:: with SMTP id v8mr4776133wrt.286.1588972798797; Fri, 08 May 2020 14:19:58 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id j16sm4646416wru.13.2020.05.08.14.19.57 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 14:19:57 -0700 (PDT) Date: Fri, 8 May 2020 21:19:57 +0000 From: Wei Yang To: "Huang, Ying" Cc: Wei Yang , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org Subject: Re: [PATCH 3/3] mm/swapfile.c: count won't be bigger than SWAP_MAP_MAX Message-ID: <20200508211957.haw4m2ityh6z5zzh@master> Reply-To: Wei Yang References: <20200501015259.32237-1-richard.weiyang@gmail.com> <20200501015259.32237-3-richard.weiyang@gmail.com> <20200501154853.bca4cfb7b2558bd43a4942f3@linux-foundation.org> <20200502132911.u6y6hkh56ik4ojne@master> <87k11pv5ep.fsf@yhuang-dev.intel.com> <20200507222014.6s5szrt6zy2b6ybo@master> <87ftcbtiha.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87ftcbtiha.fsf@yhuang-dev.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 07:48:01AM +0800, Huang, Ying wrote: >Wei Yang writes: > >> On Wed, May 06, 2020 at 04:22:54PM +0800, Huang, Ying wrote: >>>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. >>> >> >> If __swap_duplicate() run for a migration entry, it returns since >> get_swap_entry() couldn't find a swap_info_struct. So the return value is >> -EINVAL. >> >> While when this situation would happen? And the race condition you mean is? > >Sorry for confusing. I don't mean there are some known race conditions >in current kernel that will trigger the error code path. I mean we may >use the error path to identify some race conditions in the future. > Yep, NP. For the code itself, do you have some comment? >I remember that Matthew thought that the swap code should work >reasonably even for garbage PTE. > >Best Regards, >Huang, Ying > >>>Best Regards, >>>Huang, Ying -- Wei Yang Help you, Help me