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 28913C35280 for ; Thu, 7 May 2020 22:20:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D7CFD2082E for ; Thu, 7 May 2020 22:20:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bCdiFMI/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D7CFD2082E 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 66F81900003; Thu, 7 May 2020 18:20:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 61E2A900002; Thu, 7 May 2020 18:20:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 533C8900003; Thu, 7 May 2020 18:20:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 3B78C900002 for ; Thu, 7 May 2020 18:20:18 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 05D2412782 for ; Thu, 7 May 2020 22:20:18 +0000 (UTC) X-FDA: 76791342516.06.jewel77_2927c5c2c750 X-HE-Tag: jewel77_2927c5c2c750 X-Filterd-Recvd-Size: 4925 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 May 2020 22:20:17 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id w7so7478707wre.13 for ; Thu, 07 May 2020 15:20:17 -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=r9L5BbR1D/yVnqyNGeh7T9On6CSzY2MQWXloV95rB8U=; b=bCdiFMI/LGeKAfCV93K0w0RNk3p5zRb/gu9k+4Lmy1KOsTt43unQmThIhkEwkErhqj ffIpyeI8Qsw/VR+7tJfXPaCr8xhku04kaz/LOc1ed7WYAqBBj11RkHgCV2R8WWuJrddQ 9f9fYr8hrPKYvHADPHAz/xc3P+ONGmR/odsOYqXNtaKE9XdAvnHMQ4og2prZ+MbWf2cw gHka2X4bdt5vykOH26JDjRhzwlZDzu/iQJ5MiGXNfSgcn0qkef/g7sKhwN9xy9jdMqwG 0W/K7Cyn5ajrN/tbFX4QpPDg0e2EISxABYVIjBv7/CcfUSkoQ2dLE6gBVGT5kyn1yH5Q UM0Q== 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=r9L5BbR1D/yVnqyNGeh7T9On6CSzY2MQWXloV95rB8U=; b=i/YU2LeWKvmXAwllTRD34RLyKyPR0ZuyBhF1k0HUdeMMmQU3mlXpetzKzuqyxOrY8b +ppF+kzNMMLDngxCE2mQC+c3zwoO+Llcn/TvWDz8ZT4ENzpqlsP9dASy1HNGYs+hGK3b dNg/KxMz69cKj3qRgK2QwD8PmIwG/EKrGKNw8U3VK1CjycfDEukQAoP177g2jqCtCDkL 8UpG0LFuajnn7WaWmu0EsI1q6SI6J3RWkIUhBiTWttHnblQGWkzYL4FxnLe1gMUC4uGa 7aKD+vRS4vwg2WfiCu7MsNmFbH6/WsZ25tjTOD7ZmKjegEYZ+9qVrgD411Pp2s6/NWO2 uMoA== X-Gm-Message-State: AGi0PuaCYy9+/bPS2tRzp7URrTtN2YhBWExf+FP9GA6pd0LE2wojjn9X /Kui7cKv1wMNNhAt0Fk4lTc= X-Google-Smtp-Source: APiQypKA/L4nT1B8zrI/psQzZhDE/LV+Zp8vgbS4hJkhPPW5GZHcOjFxofXX5nHsyc6kcK/dOXhXXw== X-Received: by 2002:a05:6000:1089:: with SMTP id y9mr18191404wrw.306.1588890016517; Thu, 07 May 2020 15:20:16 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id j2sm3915696wrp.47.2020.05.07.15.20.15 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 May 2020 15:20:15 -0700 (PDT) Date: Thu, 7 May 2020 22:20:14 +0000 From: Wei Yang To: "Huang, Ying" Cc: Wei Yang , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/3] mm/swapfile.c: count won't be bigger than SWAP_MAP_MAX Message-ID: <20200507222014.6s5szrt6zy2b6ybo@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87k11pv5ep.fsf@yhuang-dev.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Bogosity: Ham, tests=bogofilter, spamicity=0.001006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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? >Best Regards, >Huang, Ying -- Wei Yang Help you, Help me