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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75745C433EF for ; Thu, 21 Jul 2022 15:58:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C73718E0001; Thu, 21 Jul 2022 11:58:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C21E26B0072; Thu, 21 Jul 2022 11:58:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AC2338E0001; Thu, 21 Jul 2022 11:58:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9DA0F6B0071 for ; Thu, 21 Jul 2022 11:58:44 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6F68E14071E for ; Thu, 21 Jul 2022 15:58:44 +0000 (UTC) X-FDA: 79711564968.24.5F401F4 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by imf19.hostedemail.com (Postfix) with ESMTP id 196C41A008D for ; Thu, 21 Jul 2022 15:58:43 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id h8so2921750wrw.1 for ; Thu, 21 Jul 2022 08:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=swGACW5Jh2L0fPaTYT636BPQVQeKVon43dJ9BYyWHwk=; b=r+w+mxLV3pDF7H2PvRP1rSgfVNzPHjXRHDyW0bx0FSpYp1xxdfqRoM2olAqDztXFE2 PrymskSXxb/ztAY1MquHjtG0OPZHvYVoOyAxVVJizv2kBU3Q4X1K7qkH/BbNu30JXFtU jhWBX1Jy7Ww9lAN0MpXsAQhFSo5xgPmW7AAMUve3/2zmUkNLIZbDLkbOVMwQ42/Zvgxm Ti1H7+z6K/40JPEy9H0KmJ3GQHMbwo2S5TK+RhZh2SpFcwkIZHoA/HDnKg2724iqIleF GGmYpUbMNf8YGpByjFYxAiFmsiC7KoY1DCuYjnD3rpRD2ICk4RJIeYEkxerGu8ODGLx2 Oc0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=swGACW5Jh2L0fPaTYT636BPQVQeKVon43dJ9BYyWHwk=; b=7Jek1ZKPjCtj+A6Fu5r/r+KcsvdVpH9CorMz8Y4piWaxCB6Tf20sM/+fq69oC7GQNy xN+1Eatuz9U+ISIdQKMjKiq7ffSxZQbIt06rFLUK+hQfVk2Ngm0cliG1wOwymoVjznlq awH/UISru0gzrH2vaZzGaWGssi7OiYxK+WLqRRoV4DA3w2J1mzLfqdb/GNOJB3IFfqai Osbe39qG2FWo+RojyhujSbGh8hK/IrkEzGqti5omjd3a+jTgbIUAK9XdVY8LPsu5xEnu 0sCvzcF/yAjS1mlaHcMjtfpkgMmwFNDYAl5DFFPR3uDDyoPiQTqluxIgo6QWtQHLfK5q ra2g== X-Gm-Message-State: AJIora+AirEx0mr5kGP4JO+wnaJDWEHuCfa7qs0m89Hq/AHRCquRMBum OxyPUuDBqm2Rnl/JCrtGqZcP+Aa61Z3ANhx0UtvX4w== X-Google-Smtp-Source: AGRyM1ui36nmmM0kwT+BBL9kt+7hL3D05kc007Hh2x/g9jXftjz2Ge7Zcom7SuTAQth49VFnYPf/LsmoF3sLqsIZlEs= X-Received: by 2002:a5d:588b:0:b0:21d:a918:65a5 with SMTP id n11-20020a5d588b000000b0021da91865a5mr35915956wrf.210.1658419122519; Thu, 21 Jul 2022 08:58:42 -0700 (PDT) MIME-Version: 1.0 References: <20220714064918.2576464-1-yosryahmed@google.com> In-Reply-To: From: Yosry Ahmed Date: Thu, 21 Jul 2022 08:58:06 -0700 Message-ID: Subject: Re: [PATCH v4] mm: vmpressure: don't count proactive reclaim in vmpressure To: Michal Hocko 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 Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658419124; a=rsa-sha256; cv=none; b=6tbpzarcXbplwiT0FGFbgegjT3kHL1wyRljdlUVQRTynmVhCzhEoKG5WveBaYUtsk9IHMJ ILWUUyTiCStrMSNbE3rYkA/XCIS1sDKy+XmVhxoRIqEwpK+7NcYO4Wgbap0+eMgEVWnJiP BfxzrvuYE/+myz8OB6VvugQbmNryppU= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=r+w+mxLV; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=yosryahmed@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658419124; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=swGACW5Jh2L0fPaTYT636BPQVQeKVon43dJ9BYyWHwk=; b=K3NNQdxUfFEapToRYjXjJIj27/KZGoOQtbEyHqh7DMGaxXXaOdQFgarpnyKH0yPKRmafDm csV13DKuHnJSCibS5pyYfc62re8tFPXvPRraH1exjaBA9OJz5PdRRfCvP1L6VNa1OPgYla KpEJDzv2DvS6BgzwQ+mCQdYQ+ZuRGE8= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=r+w+mxLV; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf19.hostedemail.com: domain of yosryahmed@google.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=yosryahmed@google.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 196C41A008D X-Stat-Signature: das4n8f7w4q6mmnwmiiagbuakiyuqpcb X-Rspam-User: X-HE-Tag: 1658419123-469447 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 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. 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." Does this make sense to you? > > Thanks! > -- > Michal Hocko > SUSE Labs