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=-5.3 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLACK, URIBL_BLOCKED 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 63A46C433E0 for ; Wed, 3 Jun 2020 13:36:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 309D1206C3 for ; Wed, 3 Jun 2020 13:36:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 309D1206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9FBEF80007; Wed, 3 Jun 2020 09:36:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9AA728E0006; Wed, 3 Jun 2020 09:36:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8729E80007; Wed, 3 Jun 2020 09:36:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0229.hostedemail.com [216.40.44.229]) by kanga.kvack.org (Postfix) with ESMTP id 7134D8E0006 for ; Wed, 3 Jun 2020 09:36:57 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 24E13180AD83B for ; Wed, 3 Jun 2020 13:36:57 +0000 (UTC) X-FDA: 76888001274.09.ocean64_3ca458089e92d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 10F20180AD83A for ; Wed, 3 Jun 2020 13:36:57 +0000 (UTC) X-HE-Tag: ocean64_3ca458089e92d X-Filterd-Recvd-Size: 6564 Received: from mail-ej1-f68.google.com (mail-ej1-f68.google.com [209.85.218.68]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Wed, 3 Jun 2020 13:36:56 +0000 (UTC) Received: by mail-ej1-f68.google.com with SMTP id e2so2164988eje.13 for ; Wed, 03 Jun 2020 06:36:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=6yqRVuEDuzSqKLfvX5Cc+QIaoGkvX6hmBAeSVv3eG5E=; b=JNO3MV2agQT2CUkcU2jLeV51RE7hT96HS59Pns+0KbCC0eM79NuY1+IyfUnszaAbgl qAxVK3byrzl7HV4bxpiYPC/hON0AZIw/pYRFYRPd40D2ZfTyBP7XIfVEuPQf/BwpZiMP lrwzvPsfTXZ1/AFD1hs8oin2HOWeL7vESUnGvYqFtyLXmTu84DdZT79SZwYnNjfbZQL2 gBJQTN/QktyacKWEoFpG8HcpnefWcX19P2dJUNvwA/SN1NWmiE0P4ss1pP5KJ4SHiia7 7GsmtO0eTQqZ3LkXFjMcFPetr0DO5s/li0UUyRQL4Kc15KDV7iHRD8rMQXcHWiZ47S9s cgdQ== X-Gm-Message-State: AOAM5316yUrD+Eh/T3wh6tfoadELUJfb+mtBbZsp1lmUKmLVLgtWISXl QMOeRn2wAG9Pm3e/OoqR+2ZLxTbN X-Google-Smtp-Source: ABdhPJwxA219niUYoUS9z/ZrX6vb2oQZ1sB888+BP123jY+dnj0HiojUPWEyuNvIxWcgC6zadzZbOw== X-Received: by 2002:a17:906:b79a:: with SMTP id dt26mr6352256ejb.422.1591191415668; Wed, 03 Jun 2020 06:36:55 -0700 (PDT) Received: from localhost (ip-37-188-178-109.eurotel.cz. [37.188.178.109]) by smtp.gmail.com with ESMTPSA id w13sm1124390eju.124.2020.06.03.06.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 06:36:54 -0700 (PDT) Date: Wed, 3 Jun 2020 15:36:53 +0200 From: Michal Hocko To: Feng Tang Cc: Qian Cai , Andrew Morton , 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: <20200603133653.GK7533@dhcp22.suse.cz> References: <20200603094804.GB89848@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200603094804.GB89848@shbuild999.sh.intel.com> X-Rspamd-Queue-Id: 10F20180AD83A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Wed 03-06-20 17:48:04, Feng Tang wrote: > 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 kernel= s, > > > the overall performance change is trivial (which is expected) > > >=20 > > > 1330147 +0.1% 1331032 will-it-scale.72.proce= sses > > >=20 > > > But the perf stats of "self" shows big change for __vm_enough_memor= y()=20 > > >=20 > > > 0.27 -0.3 0.00 pp.self.__vm_enough_me= mory > > >=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= warning is there for so long and no one seems notice much trouble (or be= nefit) because of it, so I think you will probably need to come up with a= proper justification to explain why it is a trouble now, and how your pa= tchset suddenly start to trigger the warning as well as why it is no bett= er way but to suffer this debuggability regression (probably tiny but sti= ll). >=20 > Thanks for the suggestion, and I updated the commit log. >=20 >=20 > >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 >=20 > This check was added by 82f71ae4a2b8 ("mm: catch memory commitment unde= rflow") > 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: >=20 > : This shouldn't happen any more - the previous two patches fixed > : the committed_as underflow issues. >=20 > 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' numbe= r > for loose overcommit policies (OVERCOMMIT_ALWAYS and OVERCOMMIT_GUESS), > while keeping current number for OVERCOMMIT_NEVER. >=20 > With that patchset, when system firstly uses a loose policy, the > 'vm_committed_as' count could be a big negative value, as its big 'batc= h' > 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. >=20 > 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. >=20 > 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. >=20 > Reported-by: Qian Cai =20 > Signed-off-by: Feng Tang > Cc: Konstantin Khlebnikov > Cc: Michal Hocko > Cc: Andi Kleen Acked-by: Michal Hocko > --- > mm/util.c | 8 -------- > 1 file changed, 8 deletions(-) >=20 > 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 = pages, 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 >=20 --=20 Michal Hocko SUSE Labs