Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp169924ybz; Thu, 30 Apr 2020 18:55:04 -0700 (PDT) X-Google-Smtp-Source: APiQypIDkGteYJTJkyZg6fGPm/9idnjPuRMrCJ7w+bMEWK0dXhvhH54JSpWwYLHn/YVnshwZetQd X-Received: by 2002:a17:906:2604:: with SMTP id h4mr1171238ejc.307.1588298103893; Thu, 30 Apr 2020 18:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588298103; cv=none; d=google.com; s=arc-20160816; b=CSbH/eEOKb8ufWvRBW2i1ced7voO+HoxGKwQgYGobmGqS0lq5jnc/3S1IFAtuTaWJs CEFsAyg7qCQIbX5VPMiPGCsb0Qy+7hwhp8B6ylxLPoIrJrhK5doBUekne0W2e+ljDA4J ae4refbQTnoTkjFLtPbe9rBoOxz0Aa3cMeiTh7SX6TtcbdabboSasRTJfcO0sskPBfum IXYW4lLxphissR9AI9WIQT3aYmoB60We0od2nKowVj8WD3vOjI0STCLTjs6ZxLJxx2cK sCoyarFTAWG8qQgjcM/sC2M6vwtCmiBch5Q4NZQjEV9EoaWlTAFSjXQjfxUzUkKwIBlz xzgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=j9Kda2ZMzERIfmoRsalDd4Qs7A9RvCefihNSzH/my34=; b=spLpqXQ/15Xj+VYZYkkHGo4GxiImJa/bgFtfxAKCQF0PwdDUOXjuvPZj/rx8+sgmxv z6BwkSl4e+/QLGXlte0tfFb7rsWagYRazHwqHi0lTiOitNGaUOoUzhoIUja6u4G1yonh eist3eOV/wQJtu3IRiz5AyxRL152Y+9N903lGqQN0iHqS5l/85mzMiWlvTPlU8Qry/+a KHQ9nd2y9jdHFGJqbV8QpmB6mFWjOVaB+UDhhVb8wNgS02yYV9jd/NgIgUQ7fjD9znYb EJKlInvdjQ3WjC5qsff+sTOzZQ5lUwa1PuMS0enIzsi6AaRz/s1WLDCDGzP3ZD7XAPTG 5IIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OD86UNg7; 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 t27si819386edt.42.2020.04.30.18.54.40; Thu, 30 Apr 2020 18:55:03 -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=OD86UNg7; 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 S1727977AbgEABxQ (ORCPT + 99 others); Thu, 30 Apr 2020 21:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727114AbgEABxQ (ORCPT ); Thu, 30 Apr 2020 21:53:16 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38B90C035494 for ; Thu, 30 Apr 2020 18:53:16 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id t12so6219551edw.3 for ; Thu, 30 Apr 2020 18:53:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=j9Kda2ZMzERIfmoRsalDd4Qs7A9RvCefihNSzH/my34=; b=OD86UNg78ivHDmdcvDqv2BI4SX/8T8Rl+eFOo4cj6J9tw4UBjxoYDgcJVRoe/s3ZNE REWAULHQz46aNm3X73Kous/fi2h25vtE16oQjf+Dmj7RnV/BVAMs9iRHQZcwXAusHtqq 2WnRMTICOfsOQM4T486+Sc5qmmSqZD4mMOoq3XqKevPEC6aharuMDZ2W4s7VF2ckhmya 4QByGdyGSUYnXHOkfzTk6DkJK6aiSryPa9LAt/J1qxZgZBHjAYVUWznK70EYzKOy/SFH EM2mZOl6O9IdDXsMnUeiNYW4KADz5EwkpY23HBg/g2gHuFUe+Ss67d8RDwNMPTllz1ib b2dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=j9Kda2ZMzERIfmoRsalDd4Qs7A9RvCefihNSzH/my34=; b=ZjikZ+EiN1Z2PsYTl9REZcRAs1F1RyBIA4cgJ1aw4kEBP8/Qo/Qw+rh3m+bcSB4V3q q7kUhh3bmX1n87WKhonkO+Hsl3JdzgIlRKlhItsbOhtEDA1vB5l7jeBTwgoq9WsuRH/+ ZodYfcsEXEsyzuBq10lWieYVJ1UaMS4XfovHclMoYcDUoXr6sC8BnUdDUrZEU4kcQ33Q k82D60sGXY3NmFzJUsV81MehyvenstXDO6zZjl6hG5Xb0FTBCSgKXSnbykDKM12iaZ0+ M5JoLtM/gRpHzZ+S583Bzmo2jzTwv8/sGxktYz4DHOCUcy1lnA7mA5qfsmi6ztzU2IRK HaVw== X-Gm-Message-State: AGi0Pubu4z0qKANRFqXgLqFhHkR/0Gt6+MMTOPx05hOpbsiRgvne5JVw vj0qXMLbwqV7pYn7IElazkY= X-Received: by 2002:a05:6402:22d5:: with SMTP id dm21mr1585390edb.275.1588297994845; Thu, 30 Apr 2020 18:53:14 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id ss26sm171284ejb.70.2020.04.30.18.53.13 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Apr 2020 18:53:14 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, ying.huang@intel.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Wei Yang Subject: [PATCH 1/3] mm/swapfile.c: classify SWAP_MAP_XXX to make it more readable Date: Fri, 1 May 2020 01:52:57 +0000 Message-Id: <20200501015259.32237-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org swap_info_struct->swap_map[] encodes some flag and count. And to do some condition check, it also introduces some special values. Currently those macros are defined with some magic order, which makes audience hard to understand the exact meaning. This patch split those macros into three categories: flag special value for first swap_map special value for continued swap_map May this help audiences a little. Signed-off-by: Wei Yang --- include/linux/swap.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 1e99f7ac1d7e..ec507c67529b 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -183,12 +183,17 @@ enum { #define SWAP_CLUSTER_MAX 32UL #define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX -#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ -#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ +/* Bit flag in swap_map */ #define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ -#define SWAP_CONT_MAX 0x7f /* Max count, in each swap_map continuation */ -#define COUNT_CONTINUED 0x80 /* See swap_map continuation for full count */ -#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs, in first swap_map */ +#define COUNT_CONTINUED 0x80 /* Flag swap_map continuation for full count */ + +/* Special Value in first swap_map */ +#define SWAP_MAP_MAX 0x3e /* Max count */ +#define SWAP_MAP_BAD 0x3f /* Note page is bad */ +#define SWAP_MAP_SHMEM 0xbf /* Owned by shmem/tmpfs */ + +/* Special Value in each swap_map continuation */ +#define SWAP_CONT_MAX 0x7f /* Max count */ /* * We use this to track usage of a cluster. A cluster is a block of swap disk -- 2.23.0