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=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 4F250C432BE for ; Fri, 20 Aug 2021 15:20:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 00C0661167 for ; Fri, 20 Aug 2021 15:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 00C0661167 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C8D566B0074; Fri, 20 Aug 2021 11:20:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BEE326B0075; Fri, 20 Aug 2021 11:20:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A42546B0078; Fri, 20 Aug 2021 11:20:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 8B82C6B0074 for ; Fri, 20 Aug 2021 11:20:53 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3D6DF2D4B1 for ; Fri, 20 Aug 2021 15:20:53 +0000 (UTC) X-FDA: 78495821586.13.695DD2D Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf08.hostedemail.com (Postfix) with ESMTP id DBA0A30000B9 for ; Fri, 20 Aug 2021 15:20:52 +0000 (UTC) Received: by mail-ej1-f41.google.com with SMTP id mf2so2421017ejb.9 for ; Fri, 20 Aug 2021 08:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=8KKw/Y3X2cc5tVMPl/kxkct9qTUI3pzXDdZwfJk130I=; b=srQGGc4i2tywZ5Qnahhh6GTqbqMNOHKen/sEg/S9W/n/RVwuBH24EsDhB9eOpj+RXX rpFj4gL5cKEV/2e20kJduWblm0chvohY959cUsSFRn7xmfcPWHf88ju/w8mHqD4Ijl0a o4LRGAP30Vxhxx7FZomjjxS8qoOPXplCmt9MT40wZWO2xdiOBMJPv7tmN3j8Hlc/Xyx2 vTgCTo5YUZgQFd4oGf0o1nDSUuQ8jaegH6GuMZ1AxkSsROawGppbKgBJJ7NYlDkVPA4f BLNnVVZIWD6bd+i9ytSr/uvicx6QSwZsgN/UX9WrAkBcEv3vzJPhYAfiPcbsiStFi7oK MN3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=8KKw/Y3X2cc5tVMPl/kxkct9qTUI3pzXDdZwfJk130I=; b=EIWMo40SSOWCaU0Ej0z9219IhEjmVvPzbYnvqtWWcxH8IZR/hRMT8WWvOETxrElQQj XCaQPu+z05ruy5hUwM90wfvYR9qoZnPrnCUMnCX4ErVaFIbeCkTj1+xS0fnguycRYpP2 Wv3fjapkKdk31GHpMeCpURfYf5lUJKNRXtYKlECTec6Mm4a/7/S6OkLMW2E1E9Ags8HP A0+tZYpJFPeF71DZ7BuUUpu4jLQfrojGK7CYB2BzgckRbylDb62uVJGcDxrwwtgU0HA6 JTo1uX1bJHucfnX3f2gVe0eTGWoORVDiwLztdP1jTG2zC+uBTbS+3DM9WUKDANHCnlk/ wu7A== X-Gm-Message-State: AOAM532QjcsbPt2UJIwpFiEVidmJ2pUecPC4B3tVcnrc5QjyVCt5sOuK szdq03YBAS7f/ByBDvrqHcpbLVyDiYpG0vrZ6Tg= X-Google-Smtp-Source: ABdhPJw1x49PqwFmrpp5sYyS45+q8xBuz9j8fq1eNnSPU+nccRcOxAg6jxC9zxPHiYdVyZaH5lO1SpPAuV9TdsTyef0= X-Received: by 2002:a17:906:3148:: with SMTP id e8mr22082804eje.240.1629472851367; Fri, 20 Aug 2021 08:20:51 -0700 (PDT) MIME-Version: 1.0 References: <1629417219-74853-1-git-send-email-wang.yong12@zte.com.cn> In-Reply-To: From: yong w Date: Fri, 20 Aug 2021 23:20:40 +0800 Message-ID: Subject: Re: [PATCH v2] mm: Add configuration to control whether vmpressure notifier is enabled To: Michal Hocko 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=srQGGc4i; spf=pass (imf08.hostedemail.com: domain of yongwpur@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=yongwpur@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DBA0A30000B9 X-Stat-Signature: rigsop44rfp7f3b5m1sfuejbkgkoh93g X-HE-Tag: 1629472852-319641 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: 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 reason > to put a more configuration space here. Config options are not free both > 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 out > > > > unpatched: > > Gb Rep Thr CLine User(s) System(s) Wall(s) flt/cpu/s f= ault/wsec > > 2 1 1 1 0.1 0.97 1.13 485490.062 4= 63533.34 > > 2 1 1 1 0.11 0.96 1.12 483086.072 4= 65309.495 > > 2 1 1 1 0.1 0.95 1.11 496687.098 4= 69887.643 > > 2 1 1 1 0.09 0.97 1.11 489711.434 4= 68402.102 > > 2 1 1 1 0.13 0.94 1.12 484159.415 4= 66080.941 > > average 0.106 0.958 1.118 487826.81= 62 466642.7042 > > > > patched and CONFIG_MEMCG_VMPRESSURE is not set: > > Gb Rep Thr CLine User(s) System(s) Wall(s) flt/cpu/s f= ault/wsec > > 2 1 1 1 0.1 0.96 1.1 490942.682 4= 73125.98 > > 2 1 1 1 0.08 0.99 1.13 484987.521 4= 63161.975 > > 2 1 1 1 0.09 0.96 1.09 498824.98 4= 76696.066 > > 2 1 1 1 0.1 0.97 1.12 484127.673 4= 65951.238 > > 2 1 1 1 0.1 0.97 1.11 487032 4= 68964.662 > > average 0.094 0.97 1.11 489182.97= 12 469579.9842 > > > > According to flt/cpu/s, performance improved by 0.2% which is not obvio= us. > > I haven't checked how are those numbers calculated but from a very brief > look it seems like the variation between different runs is higher than > 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 Thanks for your reply. The reason for adding configuration is as follows=EF=BC=9A 1. Referring to [PATCH] psi: make disabling/enabling easier for vendor kernels, the modification is also applicable to vmpressure. 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. 3. In the case where the user does not need vmpressure, vmpressure calculation is additional overhead. 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? 4. This patch is forward compatible, because VMPRESSURE is set by default and user does not need to make any changes. For users who do not need to use vmpressure notifier or users who use psi, they can choose not to configure this function. Thanks.