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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 2A93DC432BE for ; Fri, 20 Aug 2021 15:42:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DD9066103D for ; Fri, 20 Aug 2021 15:42:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DD9066103D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 399766B0071; Fri, 20 Aug 2021 11:42:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 349786B0072; Fri, 20 Aug 2021 11:42:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2125C8D0001; Fri, 20 Aug 2021 11:42:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 043C56B0071 for ; Fri, 20 Aug 2021 11:42:11 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 9AEB62D3BB for ; Fri, 20 Aug 2021 15:42:11 +0000 (UTC) X-FDA: 78495875262.20.CF817E1 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf14.hostedemail.com (Postfix) with ESMTP id 3445A6001993 for ; Fri, 20 Aug 2021 15:42:11 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id CAAE21FE2C; Fri, 20 Aug 2021 15:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1629474129; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IvfDF5eMx9B1DGeIPF2eXAnu9j+546SJreXX4X/2/LM=; b=C5IT/PW1hmbH61XIjN7Wc8SbyMIvagbJL2zGwVShR9zzsjkQRtKGAC85D9AhbS5PM/r/SX Q1MANu0muX1nsJwo5+SvI+3h3LVOew+eE86kVRkT93DMgacaQWSR0GVtEuA7n44G23prmR JcaLFXEvnXE+yBZGph5yVDTbFq1/Z5U= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 163BFA3B9B; Fri, 20 Aug 2021 15:42:08 +0000 (UTC) Date: Fri, 20 Aug 2021 17:41:56 +0200 From: Michal Hocko To: yong w Cc: Tejun Heo , Jonathan Corbet , Andrew Morton , Vladimir Davydov , Thomas Gleixner , "Peter Zijlstra (Intel)" , Shakeel Butt , Roman Gushchin , alexs@kernel.org, Wei Yang , Hui Su , Stephen Rothwell , wang.yong12@zte.com.cn, Cgroups , linux-doc@vger.kernel.org, LKML , Linux MM , yang.yang29@zte.com.cn Subject: Re: [PATCH v2] mm: Add configuration to control whether vmpressure notifier is enabled Message-ID: References: <1629417219-74853-1-git-send-email-wang.yong12@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 3445A6001993 X-Stat-Signature: dtnnw68gpurgor6ujibmwynwgtpj9brg Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b="C5IT/PW1"; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf14.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1629474131-493054 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 Fri 20-08-21 23:20:40, yong w wrote: > Michal Hocko =E4=BA=8E2021=E5=B9=B48=E6=9C=8820=E6=97= =A5=E5=91=A8=E4=BA=94 =E4=B8=8B=E5=8D=887:26=E5=86=99=E9=81=93=EF=BC=9A > > > > On Thu 19-08-21 16:53:39, yongw.pur@gmail.com wrote: > > > From: wangyong > > > > > > Inspired by PSI features, vmpressure inotifier function should > > > also be configured to decide whether it is used, because it is an > > > independent feature which notifies the user of memory pressure. > > > > Yes, it is an independent feature indeed but what is the actual reaso= n > > to put a more configuration space here. Config options are not free b= oth > > from the user experience POV as well as the code maintenance. Why do = we > > need to disable this feature. Who can benefit from such a setup? > > > > > So we add configuration to control whether vmpressure notifier is > > > enabled, and provide a boot parameter to use vmpressure notifier > > > flexibly. > > > > Flexibility is nice but not free as mentioned above. > > > > > Use Christoph Lamenter=E2=80=99s pagefault tool > > > (https://lkml.org/lkml/2006/8/29/294) for comparative testing. > > > Test with 5.14.0-rc5-next-20210813 on x86_64 4G Ram > > > To ensure that the vmpressure function is executed, we enable zram > > > and let the program occupy memory so that some memory is swapped ou= t > > > > > > unpatched: > > > Gb Rep Thr CLine User(s) System(s) Wall(s) flt/cpu/s = fault/wsec > > > 2 1 1 1 0.1 0.97 1.13 485490.062 = 463533.34 > > > 2 1 1 1 0.11 0.96 1.12 483086.072 = 465309.495 > > > 2 1 1 1 0.1 0.95 1.11 496687.098 = 469887.643 > > > 2 1 1 1 0.09 0.97 1.11 489711.434 = 468402.102 > > > 2 1 1 1 0.13 0.94 1.12 484159.415 = 466080.941 > > > average 0.106 0.958 1.118 48782= 6.8162 466642.7042 > > > > > > patched and CONFIG_MEMCG_VMPRESSURE is not set: > > > Gb Rep Thr CLine User(s) System(s) Wall(s) flt/cpu/s = fault/wsec > > > 2 1 1 1 0.1 0.96 1.1 490942.682 = 473125.98 > > > 2 1 1 1 0.08 0.99 1.13 484987.521 = 463161.975 > > > 2 1 1 1 0.09 0.96 1.09 498824.98 = 476696.066 > > > 2 1 1 1 0.1 0.97 1.12 484127.673 = 465951.238 > > > 2 1 1 1 0.1 0.97 1.11 487032 = 468964.662 > > > average 0.094 0.97 1.11 48918= 2.9712 469579.9842 > > > > > > According to flt/cpu/s, performance improved by 0.2% which is not o= bvious. > > > > I haven't checked how are those numbers calculated but from a very br= ief > > look it seems like the variation between different runs is higher tha= n > > 0.2%. Have you checked the average against standard deviation to get = a > > better idea whether the difference is really outside of the noise? > > -- > > Michal Hocko > > SUSE Labs >=20 > Thanks for your reply. > The reason for adding configuration is as follows=EF=BC=9A All those reasons should be a part of the changelog. > 1. Referring to [PATCH] psi: make disabling/enabling easier for vendor > kernels, the modification > is also applicable to vmpressure. >=20 > 2. With the introduction of psi into the kernel, there are two memory > pressure monitoring methods=EF=BC=8C > it is not necessary to use both and it makes sense to make vmpressure > configurable. I am not sure these are sufficient justifications but that is something to discuss. And hence it should be a part of the changelog. > 3. In the case where the user does not need vmpressure, vmpressure > calculation is additional overhead. You should quantify that and argue why that overhead cannot be further reduced without config/boot time knobs. > In some special scenes with tight memory, vmpressure will be executed > frequently.we use "likely" and "inline" > to improve the performance of the kernel, why not reduce some > unnecessary calculations? I am all for improving the code. Is it possible to do it by other means? E.g. reduce a potential overhead when there no events registered? --=20 Michal Hocko SUSE Labs