From patchwork Fri Oct 30 18:57:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Su X-Patchwork-Id: 11870661 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 CB06E697 for ; Fri, 30 Oct 2020 18:57:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 52CFA2072C for ; Fri, 30 Oct 2020 18:57:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="XUYL0Rt5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52CFA2072C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=163.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8BAFC6B0036; Fri, 30 Oct 2020 14:57:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 86D616B005C; Fri, 30 Oct 2020 14:57:23 -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 7A9B96B005D; Fri, 30 Oct 2020 14:57:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0123.hostedemail.com [216.40.44.123]) by kanga.kvack.org (Postfix) with ESMTP id 4E87A6B0036 for ; Fri, 30 Oct 2020 14:57:23 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EE17D1EE6 for ; Fri, 30 Oct 2020 18:57:22 +0000 (UTC) X-FDA: 77429499924.30.point37_46003fa27298 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id C63EE180B3C8B for ; Fri, 30 Oct 2020 18:57:22 +0000 (UTC) X-Spam-Summary: 1,0,0,21bcdf95b470f910,d41d8cd98f00b204,sh_def@163.com,,RULES_HIT:41:355:379:560:582:800:960:966:973:988:989:1152:1260:1277:1312:1313:1314:1345:1381:1437:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:3138:3139:3140:3141:3142:3353:3865:3866:3868:3870:3871:4385:4423:5007:6261:6653:10004:10400:10450:10455:11026:11334:11473:11658:11914:12043:12296:12297:12438:12555:12895:13069:13161:13229:13311:13357:13439:13895:14096:14097:14181:14394:14721:19904:19999:21080:21433:21451:21627:21990:30034:30054:30070,0,RBL:220.181.12.14:@163.com:.lbl8.mailshell.net-66.100.201.100 62.50.2.100;04yr9n97coye77tz7qfxsy46koc79ockmdfmcu4bf15rkibi3kfymg71br7w81f.9k83uttyochw4t1736r6ei7kxrf7odekh5ab79pzmi36qw8j7mdo5r6x3ysbjjm.4-lbl8.mailshell.net-223.238.255.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:67,LUA_SUMMARY:none X-HE-Tag: point37_46003fa27298 X-Filterd-Recvd-Size: 3061 Received: from m12-14.163.com (m12-14.163.com [220.181.12.14]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Fri, 30 Oct 2020 18:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=FTOYd 4xfiIeQjxtwB6Cv+3cAXXCIcv2qvGvBd4ClkuI=; b=XUYL0Rt5gE4mFraONWcOn Vy7rfuZfKcF0InNH+LVF9XO+IzhklNV7TMzZYUQ5Y5Pp3oFG+y9qGjwiryIYR8ZL l6/f8RPlD5ELgUE8PEKaojmZut0hNzWmnWpGqGVa+B1cPmjhWnkJDcZvUl1Qz2r+ ZvZBXvmpQzXMnLFV4LFYjI= Received: from localhost (unknown [101.86.209.82]) by smtp10 (Coremail) with SMTP id DsCowADHDvsOYpxfc9EpTA--.36234S2; Sat, 31 Oct 2020 02:57:18 +0800 (CST) Date: Sat, 31 Oct 2020 02:57:18 +0800 From: Hui Su To: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: define flags using bit numbers Message-ID: <20201030185718.GA150073@rlk> MIME-Version: 1.0 Content-Disposition: inline X-CM-TRANSID: DsCowADHDvsOYpxfc9EpTA--.36234S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tFy5WF4ktFW5Ww43KF1rWFg_yoW8Wr48pF Z0gF98Gr1FvF42k3Z2yF1DWFy8AFWDKay7Kr1j934xu3W3Xr18XF95AF45Za4rXFZ3Gay3 uwn09347Zr1qyFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jyiihUUUUU= X-Originating-IP: [101.86.209.82] X-CM-SenderInfo: xvkbvvri6rljoofrz/1tbipA7NX1r7rHdVdwAAsg X-Bogosity: Ham, tests=bogofilter, spamicity=0.127443, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: These flag is meant the bit numbers, they are used like '(type & SLOTS_CACHE)' and so on. Define these flags using bit numbers instead of hardcoding powers of 2, which maybe better. No change in the actual values. Signed-off-by: Hui Su --- mm/swap_slots.c | 4 ++-- mm/swapfile.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 0357fbe70645..18e7a01fd35c 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -47,8 +47,8 @@ static void deactivate_swap_slots_cache(void); static void reactivate_swap_slots_cache(void); #define use_swap_slot_cache (swap_slot_cache_active && swap_slot_cache_enabled) -#define SLOTS_CACHE 0x1 -#define SLOTS_CACHE_RET 0x2 +#define SLOTS_CACHE (1 << 0) +#define SLOTS_CACHE_RET (1 << 1) static void deactivate_swap_slots_cache(void) { diff --git a/mm/swapfile.c b/mm/swapfile.c index c4a613688a17..a0476c121c0e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -113,14 +113,14 @@ static inline unsigned char swap_count(unsigned char ent) } /* Reclaim the swap entry anyway if possible */ -#define TTRS_ANYWAY 0x1 +#define TTRS_ANYWAY (1 << 0) /* * Reclaim the swap entry if there are no more mappings of the * corresponding page */ -#define TTRS_UNMAPPED 0x2 +#define TTRS_UNMAPPED (1 << 1) /* Reclaim the swap entry if swap is getting full*/ -#define TTRS_FULL 0x4 +#define TTRS_FULL (1 << 2) /* returns 1 if swap entry is freed */ static int __try_to_reclaim_swap(struct swap_info_struct *si,