From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABEB6C433E2 for ; Sat, 5 Sep 2020 08:41:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2CCAA20760 for ; Sat, 5 Sep 2020 08:41:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CCAA20760 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 500096B0003; Sat, 5 Sep 2020 04:41:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B10D6B0037; Sat, 5 Sep 2020 04:41:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C69F6B0055; Sat, 5 Sep 2020 04:41:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0062.hostedemail.com [216.40.44.62]) by kanga.kvack.org (Postfix) with ESMTP id 27AF26B0003 for ; Sat, 5 Sep 2020 04:41:41 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DA535180AD804 for ; Sat, 5 Sep 2020 08:41:40 +0000 (UTC) X-FDA: 77228364360.19.lock71_6109cfd270b9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id B69541ACEA2 for ; Sat, 5 Sep 2020 08:41:40 +0000 (UTC) X-HE-Tag: lock71_6109cfd270b9 X-Filterd-Recvd-Size: 2422 Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Sat, 5 Sep 2020 08:41:39 +0000 (UTC) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 4B7758CCBF1CF98C35C5; Sat, 5 Sep 2020 16:41:31 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Sat, 5 Sep 2020 16:41:20 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm: vmstat: Use helper macro abs() Date: Sat, 5 Sep 2020 04:40:08 -0400 Message-ID: <20200905084008.15748-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.175] X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B69541ACEA2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 Content-Transfer-Encoding: quoted-printable 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: Use helper macro abs() to simplify the "x > t || x < -t" cmp. Signed-off-by: Miaohe Lin --- mm/vmstat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 06fd13ebc2b8..648c2d6ddce2 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -329,7 +329,7 @@ void __mod_zone_page_state(struct zone *zone, enum zo= ne_stat_item item, =20 t =3D __this_cpu_read(pcp->stat_threshold); =20 - if (unlikely(x > t || x < -t)) { + if (unlikely(abs(x) > t)) { zone_page_state_add(x, zone, item); x =3D 0; } @@ -354,7 +354,7 @@ void __mod_node_page_state(struct pglist_data *pgdat,= enum node_stat_item item, =20 t =3D __this_cpu_read(pcp->stat_threshold); =20 - if (unlikely(x > t || x < -t)) { + if (unlikely(abs(x) > t)) { node_page_state_add(x, pgdat, item); x =3D 0; } @@ -515,7 +515,7 @@ static inline void mod_zone_state(struct zone *zone, o =3D this_cpu_read(*p); n =3D delta + o; =20 - if (n > t || n < -t) { + if (abs(n) > t) { int os =3D overstep_mode * (t >> 1) ; =20 /* Overflow must be added to zone counters */ @@ -577,7 +577,7 @@ static inline void mod_node_state(struct pglist_data = *pgdat, o =3D this_cpu_read(*p); n =3D delta + o; =20 - if (n > t || n < -t) { + if (abs(n) > t) { int os =3D overstep_mode * (t >> 1) ; =20 /* Overflow must be added to node counters */ --=20 2.19.1