From patchwork Fri May 1 01:52:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 11522007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCB4C913 for ; Fri, 1 May 2020 01:53:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94B2E20873 for ; Fri, 1 May 2020 01:53:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OD86UNg7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94B2E20873 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 C741F8E0005; Thu, 30 Apr 2020 21:53:16 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BFE048E0001; Thu, 30 Apr 2020 21:53:16 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AED918E0005; Thu, 30 Apr 2020 21:53:16 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id 92F918E0001 for ; Thu, 30 Apr 2020 21:53:16 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 577C9181AEF07 for ; Fri, 1 May 2020 01:53:16 +0000 (UTC) X-FDA: 76766477592.08.magic99_90f4b43989f37 X-Spam-Summary: 2,0,0,06ff0d83847a4fba,d41d8cd98f00b204,richard.weiyang@gmail.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2198:2199:2393:2553:2559:2562:2692:2731:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:5007:6261:6653:7514:7903:9413:10004:11026:11473:11658:11914:12296:12297:12517:12519:12555:12895:13069:13311:13357:14096:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:21990:30054:30070:30090,0,RBL:209.85.208.65:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:23,LUA_SUMMARY:none X-HE-Tag: magic99_90f4b43989f37 X-Filterd-Recvd-Size: 4450 Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Fri, 1 May 2020 01:53:16 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id k22so6224229eds.6 for ; Thu, 30 Apr 2020 18:53:15 -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=OML9tGNnHiufbupi3GDdIhpYmzX6XSUTbMuSK3mY4CxNw+cfwL26JocyjNkZFVGchp M2CpRr2RHEgWeRg6B5hQsYOF5rbHwrgGQpZiBB800YjLvnOvpXQ84NRq5Rr+So4xCop0 mwdi0+i6y5Yu9NvYZ2dTAYhR0WJzNB7tsGEe6rcNP8zhBq1AsxtyLsUlpD4FVu23x7a5 ixsgHrdyljMHTVgSR+k9l1T0Zq2kIxAq+2NCGYE1e6x6flPkHKbOPrr8NaQDSxr1rtc6 yeU1URnz3dHcbm9w26bFT5WKikG7BcG4Dwu4YUk47dJqtQIPvhqiQ9d6Pzl92MilaaRG IIaA== X-Gm-Message-State: AGi0PuY+RJPQyioQKUXSPaSHTpvYiu/ITaZUQg7HMj0YECMoeLEwYs2s TmcdVjdOF/a0VwISf5jWks8= X-Google-Smtp-Source: APiQypISfC9xoj/GtBzBklPyzxul23IZsdu7YUppY2oWHs6suogoxtNDpwtr/QjuP/+4F4OUbYX3MQ== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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