Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1726074ybz; Sat, 2 May 2020 06:31:00 -0700 (PDT) X-Google-Smtp-Source: APiQypLOyNGz3Zlt/pM9260/NqROmBD/3qUOUJzXWVsnJZTFb6TsBJv2W9qziLz860w0C5w6eANO X-Received: by 2002:a17:906:4310:: with SMTP id j16mr7824398ejm.102.1588426260737; Sat, 02 May 2020 06:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588426260; cv=none; d=google.com; s=arc-20160816; b=hRYNfTAmcAzT9trdV16q7JJ7fbhyyMT3J6gSw23PWXK/UW5xUhs8/anJaMfCrZwL1D u6904RYcWQth10xm3AuZxyE0+OwCyXbmt/8+cEYEEp0u8zTFMuJZPoPMR6O5SQ2o3ea3 zgfJJFgUWwMT70M2BZOsd7nsMIy0NUgJmyoXN1V5D/HZTzOdEv5015wyNZRykKzC6BvE dqQaareuy354IpSD05dLBy70PoZwtIUIQdoIR/+HQ0DwF/N5OXzH8NmRxP6HO/jPe4t9 P9FlQQBnJ+X04A2oMjY5hc017xzqvMX1KJlpKERrcVGuvLqilZ+NIwxSVfrwwujqX7C1 B0Dw== 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=7fgGtqyzL/Sj2g+73BGn6b3nve4tTxBVOiuWb2m+SYk=; b=EA9wzDOkSu/QxcBHFNh6jTxGZrWKbgbB2i5lWxXn0ACPVc15epIAb+PYWqm2AwnDuD rN+0+aCPqXS1PPwIKYoHlArYMOpc4ynOf/KsiiMw0meveJ5cz1pU+VyyXSlqUezfj+Wq i09S5ZlCh7JkTqoYOMoI07fwlTInN7UDSjH8WFrFuFEqlvA6NfMFlNDE3c9QJicNSMco mwXJztRjL4Zkdh1e/jsk6revdzitYnErClYS7Q8c1o9SZaB483uNSh68h7OFcfjOXDL3 zyLuZXLjXz2CKTOcJY9XKZLbxx1OG9k7NCeJDN7VRJk+XWGKlkLhwa7oPJUV1ezBy8Yb FL/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nFsXSuI8; 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 di22si3453566edb.427.2020.05.02.06.30.37; Sat, 02 May 2020 06:31:00 -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=nFsXSuI8; 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 S1728009AbgEBN3P (ORCPT + 99 others); Sat, 2 May 2020 09:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727880AbgEBN3O (ORCPT ); Sat, 2 May 2020 09:29:14 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F326C061A0C for ; Sat, 2 May 2020 06:29:14 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id k12so3061147wmj.3 for ; Sat, 02 May 2020 06:29:14 -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=7fgGtqyzL/Sj2g+73BGn6b3nve4tTxBVOiuWb2m+SYk=; b=nFsXSuI8ZhlJ9+6dQXFcFImncSkTD+VcPf7wjZAkyfn5I0TQG3AE+lEKyfVt7XmmLP QCHzZ7sKGUf1RTVD1lHZhiSEk8gPFax2TQvpeAszNZAPopIcnTZUbfNSJEt3+SPXc+4e tj/p2TDObgTCucbOfIQfL/OV8Mi9nXDm6ZpDmsWgvklI/SnKPwaVUJcCcXVar0XhkO5W oGlcHXmPcJz3jMr9+Dakk6tjzYtzlbwlhJzSdJFURBurOB4RrK8DRzbtGtuYMvE36/EI 4T26fZkgiZfVBJb5Tsw0IDP9CYcX8M7E/mwCxYFOxK/Lnv1TXLD1PSKz8Wb8ulnGnFPD IYkA== 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=7fgGtqyzL/Sj2g+73BGn6b3nve4tTxBVOiuWb2m+SYk=; b=RC7LxVWOi+HNCE75XZb89iwy5yPEhJA99KyxcSqmX1U1lXof0uqifLDrU10wasgVu7 ylKF3cQ9jPCaZmd3vsj98BhTIR0O2r/FjbTce/CAJ5QtInry2LnUXc0TJqzY3SIXFRi7 GU072pwmblJ65NPhOCOW/LDxrUDXhdsLy3G/1z8LzPFZGo4AP54A+bFKqjn15KbIukkO Z93aKCO6ZL6sAGjP6+U2DkscOr5voEkP9FUFdb0LFxJUelVxpteZyih+xP460tWxAoFt sP7Tgg9jmpU6zrqEle+OK4Vhv1bNWmyUKftj7QFTlYFuOffvaZc4HqOagv45unvuaMfL yFLw== X-Gm-Message-State: AGi0PuZp5jQtHeNxnep5Og9beV399gdmgVeY7QkE1N5mmfEoqL7enmKv m4cs4i4neV8ELWzxGXxPhkg= X-Received: by 2002:a1c:4ca:: with SMTP id 193mr4751167wme.18.1588426153168; Sat, 02 May 2020 06:29:13 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id v131sm4670262wmb.19.2020.05.02.06.29.11 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 May 2020 06:29:12 -0700 (PDT) Date: Sat, 2 May 2020 13:29:11 +0000 From: Wei Yang To: Andrew Morton Cc: Wei Yang , ying.huang@intel.com, 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: <20200502132911.u6y6hkh56ik4ojne@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200501154853.bca4cfb7b2558bd43a4942f3@linux-foundation.org> 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 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. >> The first case would be filtered by the first if in __swap_duplicate(). >> >> And the second case means this swap entry is for shmem. Since we never >> do another duplication for shmem swap entry. This won't happen neither. > -- Wei Yang Help you, Help me