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=-6.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLACK,URIBL_BLOCKED,USER_AGENT_SANE_1 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 BA805C433E1 for ; Wed, 3 Jun 2020 09:48:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6681220679 for ; Wed, 3 Jun 2020 09:48:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6681220679 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AC4F480007; Wed, 3 Jun 2020 05:48:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A75258E0006; Wed, 3 Jun 2020 05:48:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98BC180007; Wed, 3 Jun 2020 05:48:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0185.hostedemail.com [216.40.44.185]) by kanga.kvack.org (Postfix) with ESMTP id 80DF08E0006 for ; Wed, 3 Jun 2020 05:48:11 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 40E89A751 for ; Wed, 3 Jun 2020 09:48:11 +0000 (UTC) X-FDA: 76887424782.30.group47_647ea7ceccd41 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 2125F180B3C83 for ; Wed, 3 Jun 2020 09:48:11 +0000 (UTC) X-HE-Tag: group47_647ea7ceccd41 X-Filterd-Recvd-Size: 5402 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Wed, 3 Jun 2020 09:48:10 +0000 (UTC) IronPort-SDR: 3zmR2MoSPRv5+y6DXpG9FiDS3yz286PPZdiE5qam7Bjmn9K4z+xmdCooY74K26xYA3qPfUwiYG BO1RBTIF1JQQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2020 02:48:08 -0700 IronPort-SDR: BkwBQ/BHqe1tonku3ksMYgxt4OD8StANvjvo9vJtQJn4ihY0f+YLmjOugXm+LeJNDB1EUNFCrz wef8VnH/rkew== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,467,1583222400"; d="scan'208";a="378049486" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.146.107]) by fmsmga001.fm.intel.com with ESMTP; 03 Jun 2020 02:48:04 -0700 Date: Wed, 3 Jun 2020 17:48:04 +0800 From: Feng Tang To: Qian Cai Cc: Andrew Morton , Michal Hocko , Johannes Weiner , Matthew Wilcox , Mel Gorman , Kees Cook , andi.kleen@intel.com, tim.c.chen@intel.com, dave.hansen@intel.com, ying.huang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Konstantin Khlebnikov Subject: Re: [PATCH v4 3/4] mm/util.c: remove the VM_WARN_ONCE for vm_committed_as underflow check Message-ID: <20200603094804.GB89848@shbuild999.sh.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Rspamd-Queue-Id: 2125F180B3C83 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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: On Tue, Jun 02, 2020 at 12:02:22AM -0400, Qian Cai wrote: >=20 >=20 > > On Jun 1, 2020, at 11:37 PM, Feng Tang wrote: > >=20 > > I re-run the same benchmark with v5.7 and 5.7+remove_warning kernels, > > the overall performance change is trivial (which is expected) > >=20 > > 1330147 +0.1% 1331032 will-it-scale.72.process= es > >=20 > > But the perf stats of "self" shows big change for __vm_enough_memory(= )=20 > >=20 > > 0.27 -0.3 0.00 pp.self.__vm_enough_memo= ry > >=20 > > I post the full compare result in the end. >=20 > I don=E2=80=99t really see what that means exactly, but I suppose the w= arning is there for so long and no one seems notice much trouble (or bene= fit) because of it, so I think you will probably need to come up with a p= roper justification to explain why it is a trouble now, and how your patc= hset suddenly start to trigger the warning as well as why it is no better= way but to suffer this debuggability regression (probably tiny but still= ). Thanks for the suggestion, and I updated the commit log. >From 1633da8228bd3d0dcbbd8df982977ad4594962a1 Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Fri, 29 May 2020 08:48:48 +0800 Subject: [PATCH] mm/util.c: remove the VM_WARN_ONCE for vm_committed_as underflow check This check was added by 82f71ae4a2b8 ("mm: catch memory commitment underf= low") in 2014 to have a safety check for issues which have been fixed. And there has been few report caught by it, as described in its commit log: : This shouldn't happen any more - the previous two patches fixed : the committed_as underflow issues. But it was really found by Qian Cai when he used the LTP memory stress suite to test a RFC patchset, which tries to improve scalability of per-cpu counter 'vm_committed_as', by chosing a bigger 'batch' number for loose overcommit policies (OVERCOMMIT_ALWAYS and OVERCOMMIT_GUESS), while keeping current number for OVERCOMMIT_NEVER. With that patchset, when system firstly uses a loose policy, the 'vm_committed_as' count could be a big negative value, as its big 'batch' number allows a big deviation, then when the policy is changed to OVERCOMMIT_NEVER, the 'batch' will be decreased to a much smaller value, thus hits this WARN check. To mitigate this, one proposed solution is to queue work on all online CPUs to do a local sync for 'vm_committed_as' when changing policy to OVERCOMMIT_NEVER, plus some global syncing to garante the case won't be hit. But this solution is costy and slow, given this check hasn't shown real trouble or benefit, simply drop it from one hot path of MM. And perf stats does show some tiny saving for removing it. Reported-by: Qian Cai =20 Signed-off-by: Feng Tang Cc: Konstantin Khlebnikov Cc: Michal Hocko Cc: Andi Kleen --- mm/util.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mm/util.c b/mm/util.c index 9b3be03..c63c8e4 100644 --- a/mm/util.c +++ b/mm/util.c @@ -814,14 +814,6 @@ int __vm_enough_memory(struct mm_struct *mm, long pa= ges, int cap_sys_admin) { long allowed; =20 - /* - * A transient decrease in the value is unlikely, so no need - * READ_ONCE() for vm_committed_as.count. - */ - VM_WARN_ONCE(data_race(percpu_counter_read(&vm_committed_as) < - -(s64)vm_committed_as_batch * num_online_cpus()), - "memory commitment underflow"); - vm_acct_memory(pages); =20 /* --=20 2.7.4