Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5057018rdb; Sat, 16 Sep 2023 00:42:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHDauIEhwzpzE8/lmGjTJhzAXG4rae2v4/vUsQN9e08Mlea9abP+/uHDAETs7MCOqfLNNAH X-Received: by 2002:a17:90a:f401:b0:26d:1a46:1646 with SMTP id ch1-20020a17090af40100b0026d1a461646mr3113272pjb.48.1694850145339; Sat, 16 Sep 2023 00:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694850145; cv=none; d=google.com; s=arc-20160816; b=0eVEw7bGmagvArzQv4emcpDx9AeoltNafvvV+b4HXWLfzXSlb1v4aQZvD2p7BgP785 3Mdo2eMg1yd2Mc4OJHrU7eSv4uYKzu2pDMIdclPNST6y73aaokioRDPlXH3Hy+J4adCI WQjJ3K8eiEPlhBhNbpLJtyEuLMlCPGYB2bIVLA/OSR6ovtqyzqmMZPpaZB4qw+hRJZQO gLXAJnKGZBC8VdaNtfI7ORgj+4jBNfu2ZPCwuIfjx61GbBj5DgnXlJH9E3xM6jkDOYpS b2OpsSAXMhnBrTufHJeEr7msKe3lacVRzUJr8XwWyQkN90KfYWyFZZ/kTpIFrwpE1q/a oVCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ldtjCWhn5cbHIMPW1zk7VmYyZJ2iO7oYLIHE3RYnz9I=; fh=SYYSX5RDY/Pw5hAW9b5Dhiv4STOsPwIvYvcBWUkG/80=; b=ai3BL+fuFguTV8tZj6BEBl3Izv334FIuuZoY9jHkcMk4JS+9ujG5v/iBq7ksbwBc0q yy3WF8JbQaHpDCIN581w3azH/cCkUkxwk6meO3uBBBRMA5Li1gP+yACrI/ifScBmqqYq 1wwiYB/+OqmzZy2t4l0+i3TR16MrqGmIdgqZ1Mf/A6IcySSMI6JCJi210jg4xPb3UBtO ihOIvof14qObzhHAxDnyNTF42AchgXBkjfpXLGYmnjvvlZdVWDLjfxqildzl01wTP8DY 7/k9HJJrOF/7aYqLEnzrMIoPyiGUAK6v3q8uWATYX9U6RhZ5KiqxzwsvjW0wX6AiujeS 0IeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ApnAbBcC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ot9-20020a17090b3b4900b00256d7cc5b67si4841442pjb.133.2023.09.16.00.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 00:42:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=ApnAbBcC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DE75583BBD80; Fri, 15 Sep 2023 01:48:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233066AbjIOIsC (ORCPT + 99 others); Fri, 15 Sep 2023 04:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232825AbjIOIsB (ORCPT ); Fri, 15 Sep 2023 04:48:01 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6BC32729 for ; Fri, 15 Sep 2023 01:47:34 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1c43166b7e5so3963125ad.3 for ; Fri, 15 Sep 2023 01:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1694767654; x=1695372454; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ldtjCWhn5cbHIMPW1zk7VmYyZJ2iO7oYLIHE3RYnz9I=; b=ApnAbBcCZB5/4sZ51oiD9BqX2/NyW9ECiUOs80ohWFrPn+a8Im9RJRseXIermvH+ZO Mn/PvXdPxJ0fGMld9laYs81uj3dNxmyKauoXGTzqeTYKFPweOvA1Ao4c+VT6ro9N1m9p LYCrTsKyHDgC+QzF/GPGHBbowWG2byPmXck8TEfByBky0LNA/92hl7YnMST9XguU4vK3 l94CscPwxnnWYz35cEfQJiRRQosuMvry3sWnYuKCOloCqao8BxXTX+7uO7AIxMiFKtQv WwXTmjWugSDhVLuBbv40VGRU70A0LqpbSBW2NxArUp1W/tQNbVo4xkUv3v0BPvMCWyTd FglA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694767654; x=1695372454; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ldtjCWhn5cbHIMPW1zk7VmYyZJ2iO7oYLIHE3RYnz9I=; b=HL6z/XCJFvImRBmNlm4VDz35ukjr+eZ7dx4j+poMvBo5dZWJ5U32AFMuephRRhzm10 zm+eOWYIAVvZMnkVWciUsW17E7g6sAdFYq6AEjDtT9vaSMNLsGhMRHzTqM3ztFTdJ9OZ z1JjEG9NtBLblPo8uq9gpdWYtDLm2uReRBBeK0zf0Xh38inpZEbB7LPVOXL3uyEcdmL2 wz/T1UOrV1BbnUa2urkZkCohrq88Z73f7vzO5T6r4xx0hxXI6DkX2r4AVNH8ZTnaM+Hv ikp+WejR1xr/b0h+BTzN/d4aXtf0PxqZltC00KSrRVLbAlynp5Mht6auUIvQr5/mKCFN whEA== X-Gm-Message-State: AOJu0YwGLB6b39DPksTDXCzF9MR7N1C09lslAZ1K+i+GU/iL3AcQpUdg bnilDK8PUGdwHZd+/TtpWZK+Vw== X-Received: by 2002:a17:902:c191:b0:1bb:ce4a:5893 with SMTP id d17-20020a170902c19100b001bbce4a5893mr883577pld.30.1694767654337; Fri, 15 Sep 2023 01:47:34 -0700 (PDT) Received: from [10.84.152.163] ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id x20-20020a170902ea9400b001bb28b9a40dsm2962631plb.11.2023.09.15.01.47.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Sep 2023 01:47:33 -0700 (PDT) Message-ID: <8d6bf3e9-5e44-cd83-bc49-c9dddd7b6b03@bytedance.com> Date: Fri, 15 Sep 2023 16:47:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: Re: [RFC PATCH net-next 0/3] sock: Be aware of memcg pressure on alloc To: Shakeel Butt Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Morton , Roman Gushchin , Michal Hocko , Johannes Weiner , Yosry Ahmed , "Matthew Wilcox (Oracle)" , Yu Zhao , Kefeng Wang , Yafang Shao , Kuniyuki Iwashima , Martin KaFai Lau , Breno Leitao , Alexander Mikhalitsyn , David Howells , Jason Xing , open list , "open list:NETWORKING [GENERAL]" , "open list:MEMORY MANAGEMENT" References: <20230901062141.51972-1-wuyun.abel@bytedance.com> <20230914212042.nnubjht3huiap3kk@google.com> Content-Language: en-US From: Abel Wu In-Reply-To: <20230914212042.nnubjht3huiap3kk@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 01:48:12 -0700 (PDT) On 9/15/23 5:20 AM, Shakeel Butt wrote: > On Fri, Sep 01, 2023 at 02:21:25PM +0800, Abel Wu wrote: >> > [...] >> As expected, no obvious performance gain or loss observed. As for the >> issue we encountered, this patchset provides better worst-case behavior >> that such OOM cases are reduced at some extent. While further fine- >> grained traffic control is what the workloads need to think about. >> > > I agree with the motivation but I don't agree with the solution (patch 2 > and 3). This is adding one more heuristic in the code which you yourself > described as helped to some extent. In addition adding more dependency > on vmpressure subsystem which is in weird state. Vmpressure is a cgroup > v1 feature which somehow networking subsystem is relying on for cgroup > v2 deployments. In addition vmpressure acts differently for workloads > with different memory types (mapped, mlocked, kernel memory). Indeed. > > Anyways, have you explored the BPF based approach. You can induce socket > pressure at the points you care about and define memory pressure however > your use-case cares for. You can define memory pressure using PSI or > vmpressure or maybe with MEMCG_HIGH events. What do you think? Yeah, this sounds much better. I will re-implement this patchset based on your suggestion. Thank you for helpful comments! Best, Abel