From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAEBDC38A2A for ; Fri, 8 May 2020 21:20:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6FC95216FD for ; Fri, 8 May 2020 21:20:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oosTixpZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6FC95216FD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E4AC590000B; Fri, 8 May 2020 17:20:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD376900004; Fri, 8 May 2020 17:20:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C752390000B; Fri, 8 May 2020 17:20:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0227.hostedemail.com [216.40.44.227]) by kanga.kvack.org (Postfix) with ESMTP id ADA48900004 for ; Fri, 8 May 2020 17:20:00 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 670EC180AD806 for ; Fri, 8 May 2020 21:20:00 +0000 (UTC) X-FDA: 76794819360.06.cap79_746facb405733 X-HE-Tag: cap79_746facb405733 X-Filterd-Recvd-Size: 5651 Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Fri, 8 May 2020 21:20:00 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id h9so3566285wrt.0 for ; Fri, 08 May 2020 14:19:59 -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=HuxErEjzIzKXQZ74mlQMfa7hjnzkLT7IGCZ3Fs1ZA7aQVw4XcGGShNpJGB79W3J2S/ DAvI51UEpQIIT7Rm3eG3BaOGPUe/tSm/i/Q+yi8BvQUkiieWGt8ThW9GM42oiizE4UxC LBqxO5MV5X0AYNIwan+YmS0jjvbL6UkmN0REhG3FH2Lo+0K4wDj0oNIbofgVrevJ3QvF KaZnNGdvkxF5sIkm6sKo0B911ieQ9VACgY/z8qOHRbgC9j3A6ewkoKkc4RhDnhKLkOw6 FjivTG5+Wi1k2KWsgkH7lHoui8ultbrsyuB749ncIFySsTe8jMpiIhTV3REZIBh6Oixm j0FA== X-Gm-Message-State: AGi0PuZ3rI4PCkdxNcRWG5c18zeFAXB7RY7Cyn4h/83UPkt2QHjcRBxs VRu54ZyrVe+A9n5ha5pC3f8= X-Google-Smtp-Source: APiQypIf0RzejCInE82KNZmNq2Oj6brtFqFFCn3Muhdad42KKIOt1o7sFgUdgn1DTL+KgGOw7A9Owg== 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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