Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp754436imi; Thu, 21 Jul 2022 10:15:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uXupRdSSfl6CC2fMZHjYNrfjQ9nBzubnQYi3kcSxHsxVB297wqNdUi2NG0lh9P/DOJEB91 X-Received: by 2002:a17:907:d8b:b0:72f:4645:1730 with SMTP id go11-20020a1709070d8b00b0072f46451730mr17052121ejc.724.1658423703774; Thu, 21 Jul 2022 10:15:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658423703; cv=none; d=google.com; s=arc-20160816; b=vugjQHPNADOMjc36KwYEGBLkoXPakH9sVOKOh6ozODQQyveEpnc0S8SHfZ9s0VrIbw j6K+nuB2ljag35ZrM2bTkONskD4i7Uf6tXoz/iBFQ4BsodXiMZsTfPsu8s2Rpawyo1vu 6LGMOlDQr7SsxtSAyxMLcP7BNsnw3QuCfK8VMCzch2KVwtBfHsYzoATOcCk71ZuMWh/N SxR2vta21QzoDDorHJLg0BQ4MRRKf3gGD5S2w02fs2ThvVfsQxtUYkOctYiCAiHO1vp4 gkWhlReqgtN86dvw+9dAMWjO+8iXVaFGLnSLSai15VARV7vNkdcq37QQ4xMkfrKd4BCP P/Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Qt+WwiyZiViwm6KCAndCDSnf7EhrmXRlccAiNwCFNNo=; b=ZXolTBQXoJ+5dC8qvxigA2dVvSAqtnAn6oEM0q4m/35es4vDQs9OrmyVM1957huUNR AK74cG8FKArMRrkQ1LR+sL+66gnyzG27iwAOf7YyhYyL/CqWGXalKnbdKi9Lg7XhANlu rJISn35ZnGl9IYe2SKN8yp0UM3vk08hWY6mLNUKx3jN5yA9UjLzI80uTRN+FQHQ/LLvm NidizkznrU/diKj7mejsVpbhfRObg5o/uGX+lF5gddA4vNmS3ALbdBsqGIGwxMAsBt5c 2vKVhVB3u2DO8uSENK/myJFQlhS5wRYNYjqP07kofspc2CNFt+/B/RzhppsqRoKwWA2C bvRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=s3mxsE1e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga3-20020a1709070c0300b0072ee5524541si3428578ejc.693.2022.07.21.10.14.38; Thu, 21 Jul 2022 10:15:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=s3mxsE1e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbiGUQm5 (ORCPT + 99 others); Thu, 21 Jul 2022 12:42:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231895AbiGUQmz (ORCPT ); Thu, 21 Jul 2022 12:42:55 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5127980F52; Thu, 21 Jul 2022 09:42:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id F3B3C338EF; Thu, 21 Jul 2022 16:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1658421773; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Qt+WwiyZiViwm6KCAndCDSnf7EhrmXRlccAiNwCFNNo=; b=s3mxsE1en0lqSnTJLvhyzGUsqbXkTK/v+hYViR89oTUA6bqcr5DquYpjUw8UXqkfuTKg9r KAnHtJMmRhEiRtftyKyLIUpnIF6ePyV81/KZDUEhQ78gD4XBZHOCkl+O5FcHU/ZjS/1VVv LCPs1wNQeQ4KUqmPTtw00vwJpeniXWE= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CB2D113A1B; Thu, 21 Jul 2022 16:42:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id b+3HLgyC2WI6fAAAMHmgww (envelope-from ); Thu, 21 Jul 2022 16:42:52 +0000 Date: Thu, 21 Jul 2022 18:42:52 +0200 From: Michal Hocko To: Yosry Ahmed Cc: Shakeel Butt , Johannes Weiner , Roman Gushchin , Muchun Song , Andrew Morton , Matthew Wilcox , Vlastimil Babka , David Hildenbrand , Miaohe Lin , NeilBrown , Alistair Popple , Suren Baghdasaryan , Peter Xu , LKML , Cgroups , Linux MM Subject: Re: [PATCH v4] mm: vmpressure: don't count proactive reclaim in vmpressure Message-ID: References: <20220714064918.2576464-1-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 21-07-22 08:58:06, Yosry Ahmed wrote: > On Thu, Jul 21, 2022 at 4:44 AM Michal Hocko wrote: > > > > On Wed 20-07-22 11:02:56, Yosry Ahmed wrote: > > > On Wed, Jul 20, 2022 at 10:50 AM Shakeel Butt wrote: > > > > > > > > On Wed, Jul 20, 2022 at 2:24 AM Michal Hocko wrote: > > > > > > > > > [...] > > > > > > > > > > I think what we are missing here is > > > > > - explain that this doesn't have any effect on existing users of > > > > > vmpressure user interface because that is cgroup v1 and memory.reclaim > > > > > is v2 feature. This is a trivial statement but quite useful for future > > > > > readers of this commit > > > > > - explain the effect on the networking layer and typical usecases > > > > > memory.reclaim is used for currently and ideally document that. > > > > > > > > I agree with the above two points (Yosry, please address those) but > > > > the following third point is orthogonal and we don't really need to > > > > have an answer for this patch to be accepted. > > > > > > > > > > That's great feedback, thanks Michal and Shakeel! > > > > > > How do you feel about the following commit message instead? Does it > > > address your concerns?: > > > > > > memory.reclaim is a cgroup v2 interface that allows users to > > > proactively reclaim memory from a memcg, without real memory pressure. > > > Reclaim operations invoke vmpressure, which is used in cgroup v1 to > > > notify userspace of reclaim efficiency, and used in both v1 and v2 as > > > a signal for a memcg being under memory pressure for networking (see > > > mem_cgroup_under_socket_pressure()). For the former, vmpressure > > > notifications in v1 are not affected by this change since > > > memory.reclaim is a v2 feature. > > > > > > For the latter, the effects of the vmpressure signal (according to > > > Shakeel [1]) are as follows: > > > 1. Reducing send and receive buffers of the current socket. > > > 2. May drop packets on the rx path. > > > 3. May throttle current thread on the tx path. > > > > > > Since proactive reclaim is invoked directly by userspace, not by > > > memory pressure, it makes sense not to throttle networking. Hence, > > > this change makes sure that proactive reclaim caused by memory.reclaim > > > does not trigger vmpressure. > > > > OK, looks much better. Please also add a note to the documentation about > > this side effect. > > I don't want to add something to the documentation about throttling > networking because it seems like these are implementation details that > we may change in the future. I don't know if we can document this > behavior today and then change it later. The exact mechanism on how the throttling is done is one thing. This can change. But the fact that _no_ throttling is applied is something that we shouldn't change of course. If we were really strict we shouldn't change it even now but considering that the interface is new and usecases still shaping then better now than later. > How about we document a more generic statement in memory.reclaim > documentation, like: > > "With reactive reclaim operations triggered by the kernel, the kernel > may take further actions to alleviate memory pressure (such as > throttling networking memory consumption). For proactive reclaim > operations triggered by this interface, the kernel may choose to skip > such actions as reclaim is not an indication of memory pressure." IDK, this sounds too much word lawyering to me TBH. It is better to be clear about explicitly known side effects. For example where do shrinkers stand in the light of above wording? Kernel can chose to do almost anything and I do not think we want to control which shrinkers are triggered and what they do. So I would really prefer to say something like: " Please note that the proactive reclaim (triggered by this interface) is not meant to indicate memory pressure on the memory cgroup. Therefore socket memory balancing triggered by the memory reclaim normally is not exercised in this case. This means that the networking layer will not adapt based on reclaim induced by memory.reclaim. " -- Michal Hocko SUSE Labs