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 D316DEB64D7 for ; Fri, 16 Jun 2023 07:27:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A6596B0074; Fri, 16 Jun 2023 03:27:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6568D8E0002; Fri, 16 Jun 2023 03:27:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F76E8E0001; Fri, 16 Jun 2023 03:27:40 -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 400D06B0074 for ; Fri, 16 Jun 2023 03:27:40 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0E1B040AFA for ; Fri, 16 Jun 2023 07:27:40 +0000 (UTC) X-FDA: 80907781080.16.88604A5 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf27.hostedemail.com (Postfix) with ESMTP id 51B454000A for ; Fri, 16 Jun 2023 07:27:37 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=VRySI+g5; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf27.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686900458; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9nn1acQnmBrxxKtKr0fIyJP3cG1pp8tJvpkDo6e+3KI=; b=cPUG4Kasmy1rC3l55phCjmHrNZ8vVKZVgFxNPwaj9Fhq498gXZhbIb2qIaE07mFGll+tz0 N/IJztppi9pok31lRi3BzfCerxC5vWClmNLaMrkCrYT6jeksWc+7s6+BC923H4DSwP1CJn dh+9CGdP/CkxHH6XuPFcBtoKMExD7HM= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=VRySI+g5; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf27.hostedemail.com: domain of wuyun.abel@bytedance.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=wuyun.abel@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686900458; a=rsa-sha256; cv=none; b=XYR6e6d5FfoOw5/Ual8AF7fzu2wbSnYDJV6UGsMxdq+9DICPhw9kEyTX4jRYGNUqMHV9yc 8Rao+Cden4QiQ/SYpyjvzMSRGKvT+3J5jq/COGJlBc3Q2kcXBtsSjMkTcdSNQaX9tew1Mn HSpVraDXO0K995dyWzlCGxmdjlc7H34= Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1b3d44e3d1cso3686395ad.0 for ; Fri, 16 Jun 2023 00:27:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1686900456; x=1689492456; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=9nn1acQnmBrxxKtKr0fIyJP3cG1pp8tJvpkDo6e+3KI=; b=VRySI+g5OyhFq3+xJSt3XxtxCawIas+z+Lic4uM27Z/udSbrXCTBXMbmW3AmwIUo/g +j64SzyuI3pM64/QBgs69XNPGhOiAnEjKd6QtJiH1liw/ezSt6iX9shVnsA95OXnchOh 9JvQ6UQRi5s4QwwA7Ua701jbMXoPDsn53P3dOg+psguoZBsLTojgzvwwyEy8UdhAuk71 ojp4elmyT5+Dm/h2WqZsUNvIm63ZHNQ2j7KP4DKglGusmxmVk8EFDp2wFt7xMuAuKHbj IRMA0WEPlxSgbgehJyNbJGm9KVDEcvEkN2yP5QuROXtcc5BpmvVpV0ZDyvA8ehpR3gUI s+ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686900456; x=1689492456; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9nn1acQnmBrxxKtKr0fIyJP3cG1pp8tJvpkDo6e+3KI=; b=azotCEbyhs68a/GNYCvYaj4sogNRVFEappMh0jlTVkJzQEhLeTGMX/Z+FMonyMsGyd V5N3ELmCIoBgnt/0HcgXugLm8pyeC24L0gH9QE76SSetjETHW35vEiKPCRbGJ4z3PUXi z6nU5YJPH84V8Wyv+cRNkDS5h5udZihryjzLUE5vnaIPZjjyFeKAWGsffEd22MxMADXY pYCyH59kpAot+TrXKH3aLpAnwRbIf49IrXo9N3RAnY9awcYQgwU+3P3ts6Z5XlkhGaRq v1vxLv70mIzsGBimHBL47RotuVCA7zv6tGsiy2VL9jmUGYeZC6UAX++N/8RnZsVXtXMN O3Ew== X-Gm-Message-State: AC+VfDxuvOI0H9DCtyDAu0OpkaxEDTINHvIMoXYqRhbdvR16LoaljmVh HYaaWdrQWyyXL4ysSPQks/t6fw== X-Google-Smtp-Source: ACHHUZ4Te5AMaBMV4npizDm9kAcBpyZOp8TbKLvyw8d9l0goDJOvXNEARkOTk+KEZVqTMAkytPeHmA== X-Received: by 2002:a17:902:d386:b0:1b3:f8db:6f0c with SMTP id e6-20020a170902d38600b001b3f8db6f0cmr1151225pld.58.1686900455916; Fri, 16 Jun 2023 00:27:35 -0700 (PDT) Received: from [10.254.80.225] ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id d18-20020a170902ced200b001b02713a301sm10913613plg.181.2023.06.16.00.27.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Jun 2023 00:27:35 -0700 (PDT) Message-ID: <42285da4-ea80-78ca-4c71-6562170614c8@bytedance.com> Date: Fri, 16 Jun 2023 15:27:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [RFC PATCH net-next] sock: Propose socket.urgent for sockmem isolation From: Abel Wu To: Eric Dumazet , Shakeel Butt Cc: Tejun Heo , Christian Warloe , Wei Wang , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , David Ahern , Yosry Ahmed , "Matthew Wilcox (Oracle)" , Yu Zhao , Vasily Averin , Kuniyuki Iwashima , Martin KaFai Lau , Xin Long , Jason Xing , Michal Hocko , Alexei Starovoitov , open list , "open list:NETWORKING [GENERAL]" , "open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)" , "open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)" References: <20230609082712.34889-1-wuyun.abel@bytedance.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspam-User: X-Stat-Signature: 3i6mn31ks8zw1nuthhrubjzypgyd6mfg X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 51B454000A X-HE-Tag: 1686900457-176186 X-HE-Meta: U2FsdGVkX18rUvJ5Fsr7a57QfKGwJOEDJBUMRB0UrdYGVFlfEgdrjaHUHvA24YBJs7Pt/wbimNOWQz4kMh4F7GP/xna8wULEp8bLqDBv+wRZz9OaiUXjQOLHkvJ5KfCrIhQ1qNYn3vlIQKhEOthoPmFzPtGG/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UTWf4GpprVLpb8Vrm9jR90KBXVdJVVGxAoTjG1zW5F4VHs63jeDgISN65nMFAx57VcLAct85z7aL7aXeCqHQdBssdNW5vyeLUEEhK+FCc/qa8Yp/yHmBZthml1yuZ96zIsOGxkJAXCz6qj9s+KUEht1bETwf/hKdfv+Sf2IAUxIzvg6GuQGDhJysh+OS/zZs5jTu35gCeRTTZookwmhAIhGLjIwdocHdTAPZ8Q6I6iRtkhstHkUKepEND8tsvNIC5HaHJkTESROHAoVGXwYM4ar+Lz0AmTKbS/NYv 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: Gentle ping :) Any suggestions for memory over-committed scenario? Thanks, Abel On 6/13/23 2:46 PM, Abel Wu wrote: > On 6/9/23 5:07 PM, Eric Dumazet wrote: >> On Fri, Jun 9, 2023 at 10:28 AM Abel Wu wrote: >>> >>> This is just a PoC patch intended to resume the discussion about >>> tcpmem isolation opened by Google in LPC'22 [1]. >>> >>> We are facing the same problem that the global shared threshold can >>> cause isolation issues. Low priority jobs can hog TCP memory and >>> adversely impact higher priority jobs. What's worse is that these >>> low priority jobs usually have smaller cpu weights leading to poor >>> ability to consume rx data. >>> >>> To tackle this problem, an interface for non-root cgroup memory >>> controller named 'socket.urgent' is proposed. It determines whether >>> the sockets of this cgroup and its descendants can escape from the >>> constrains or not under global socket memory pressure. >>> >>> The 'urgent' semantics will not take effect under memcg pressure in >>> order to protect against worse memstalls, thus will be the same as >>> before without this patch. >>> >>> This proposal doesn't remove protocal's threshold as we found it >>> useful in restraining memory defragment. As aforementioned the low >>> priority jobs can hog lots of memory, which is unreclaimable and >>> unmovable, for some time due to small cpu weight. >>> >>> So in practice we allow high priority jobs with net-memcg accounting >>> enabled to escape the global constrains if the net-memcg itselt is >>> not under pressure. While for lower priority jobs, the budget will >>> be tightened as the memory usage of 'urgent' jobs increases. In this >>> way we can finally achieve: >>> >>>    - Important jobs won't be priority inversed by the background >>>      jobs in terms of socket memory pressure/limit. >>> >>>    - Global constrains are still effective, but only on non-urgent >>>      jobs, useful for admins on policy decision on defrag. >>> >>> Comments/Ideas are welcomed, thanks! >>> >> >> This seems to go in a complete opposite direction than memcg promises. >> >> Can we fix memcg, so that : >> >> Each group can use the memory it was provisioned (this includes TCP >> buffers) > > Yes, but might not be easy once memory gets over-committed (which is > common in modern data-centers). So as a tradeoff, we intend to put > harder constraint on memory allocation for low priority jobs. Or else > if every job can use its provisioned memory, than there will be more > memstalls blocking random jobs which could be the important ones. > Either way hurts performance, but the difference is whose performance > gets hurt. > > Memory protection (memory.{min,low}) helps the important jobs less > affected by memstalls. But once low priority jobs use lots of kernel > memory like sockmem, the protection might become much less efficient. > >> >> Global tcp_memory can disappear (set tcp_mem to infinity)