Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1153523ybz; Fri, 1 May 2020 15:50:44 -0700 (PDT) X-Google-Smtp-Source: APiQypIYXTl+Lk0XnJ6TUUlAKIjJ+eqP6GPL2eySciSobn+WEQALmjyAX1nKer5AOwfaQPWVxD26 X-Received: by 2002:a17:906:31d7:: with SMTP id f23mr5557578ejf.59.1588373444240; Fri, 01 May 2020 15:50:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588373444; cv=none; d=google.com; s=arc-20160816; b=SXhqwdEok1gPAfsa9purpbi7joozS+mLvXNoZ4B+uyfoqhG+tm9EkVaxKxca+m9lpy CHhjwG5d/wbCzonEIVc/OQozqVjGbRWq4N62zMIYt4jENpqmFKnCtOi9GlLxBjl5macy J2IT2dP4CA+SroL5tX5Cfc6+ADdn6dpMN/FFSbK3sOiZrPXh/oLA4qVhJvAVDP0fw/HN NgUl77kRiW1GqYc9SoqU/wyLI+DrBxjSDGES8uFrXSpRylFYmiApqOhEZp8LSHSQsegB wkZAL5/w4RvPAgGaEfKxCgjQCMsneDhjgr2ytRAwbQEbxSIQbSOrqQbL3uVuoN81d+nr /bFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=tdSrJ9Irygsx3hB7KPXFjtPP9DMNg7xx1qlKOPlrcok=; b=HdUZ1swRQ1t36G9jTQ+/Vk44KznG4i8X24kKz6I4MhJgQiyl+SszcIn2EOo3FJtheh Sx3uXbYNeVY0IyooYhi8jQIIPB58Uly/GDnwhn5jvii7qhtSs/kcTl4L0iyYqntI5sRx AJfYFkAXwpexvsSpfcVXCZUSkC5YedKWafhnWqEpCq+X82lKoHKS+V7K5Czv9R/VLSMJ efZTt+6dkuOyIZ9b8o4A2eYgnf3N+DyxM61L41UvBvVDpvq9ZnJvHlIrfomrFrnkEW5D PrKooE4ohdYrt3pzNyzchC2hMMTNzTi0fYGs6Ft/5AIugo2gB2z2758iIcGmtN0DoyMf 01fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qXb1AUxF; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nh5si2508813ejb.352.2020.05.01.15.50.20; Fri, 01 May 2020 15:50:44 -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=@kernel.org header.s=default header.b=qXb1AUxF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726436AbgEAWsz (ORCPT + 99 others); Fri, 1 May 2020 18:48:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbgEAWsy (ORCPT ); Fri, 1 May 2020 18:48:54 -0400 Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2CA7C208D6; Fri, 1 May 2020 22:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588373334; bh=+8ojglKGEmkO9iB05BMBJhMJkf9Z5gTGUig9zB2BCYk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qXb1AUxFwf8SfiVD1hp1KVtxCVgLHhwERL3lbJCOXqQdCh2GuFvS/26htkilGQR4D ++9T85SXIC7GxJxaRwnLa1L0MH/Y+nuC+D6+lklVCuVQnC3GRBL+d9Te+eu784JxhI WoRVqqX4yFb7Rm5cXWyKbQzt3ZUpRasuhXHC/DBY= Date: Fri, 1 May 2020 15:48:53 -0700 From: Andrew Morton To: Wei Yang Cc: 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: <20200501154853.bca4cfb7b2558bd43a4942f3@linux-foundation.org> In-Reply-To: <20200501015259.32237-3-richard.weiyang@gmail.com> References: <20200501015259.32237-1-richard.weiyang@gmail.com> <20200501015259.32237-3-richard.weiyang@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 "|"? Also, the return value documentation says we return EINVAL for migration entries. Where's that happening, or is the comment out of date? > 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.