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=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 8C8DBC4363D for ; Tue, 22 Sep 2020 18:56:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2CECE206F4 for ; Tue, 22 Sep 2020 18:56:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="DV4EUlN2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CECE206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 51E826B0003; Tue, 22 Sep 2020 14:56:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A6DA6B0055; Tue, 22 Sep 2020 14:56:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D3986B005A; Tue, 22 Sep 2020 14:56:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 11F926B0003 for ; Tue, 22 Sep 2020 14:56:27 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C47921EF1 for ; Tue, 22 Sep 2020 18:56:26 +0000 (UTC) X-FDA: 77291603172.11.metal24_4602db027150 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 9D949180F8B80 for ; Tue, 22 Sep 2020 18:56:26 +0000 (UTC) X-HE-Tag: metal24_4602db027150 X-Filterd-Recvd-Size: 5121 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 18:56:26 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id v23so15078976ljd.1 for ; Tue, 22 Sep 2020 11:56:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ymw2XfYcqbrKxbh+VHjYTBZabPIEIeS/kxNNZK3Q7GE=; b=DV4EUlN276uVi19xQ/E+YB845hHum+zfsKpyj63GqwBiuV/FeabyS0GRc7fKnRLj2n El2H+Lui81CyaiWNLzdMPKDWLYLYwcx1t3Bl0cf+3L3WPo3DEuDxNQ32HUZUDZriBXaM MpWGnrUlGQSZRctkk3h9v7LtyueARTH7Zw6ACifO2t2eH/xXoieLo19WCHGh6emFW2HL GmTE8yAVvlKEsLZkzm01E/hInUAIwYjUtnkYA0EwlKOTTk4FrV1nf3ocHelxTfr1uAC7 KyOW0HGEZ68aIlHfds/PzuFOpCRUeXZ9/wITZ9lIbqEi8gGIzTntzaPkj4b6fpNPQFBp MF5g== 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; bh=ymw2XfYcqbrKxbh+VHjYTBZabPIEIeS/kxNNZK3Q7GE=; b=COaOjVVRmYQRGLXlUaAVMt2DF6XBUncHfpUtspWCB+yJb/dickeLmlPjCZiWWQpCH4 xGD46B4SbvLsgHJCIEX3kFSqFjXvuFQZCNGDuNFJ5R4dQQJhRtz2RecGIYwP54zAbL36 zujiYnoQ0TyJA2P3fKsQhLnC+71Oj4TKdxVemNnWJOR8TAkXgRGvVSt0a868gTR5SV3q Q201ODHM8vk4GkbljTiKa5SNTlz7Jn9/6pXZ2Koa46rZWw81cR6bAutqM0Lk2lWzkujd K1pxyMWwi3P17suVs7znsMiduyeBCEAQQIIX89Dcpasirya4pqGvF3Asili8oJVp4E/7 HnYg== X-Gm-Message-State: AOAM531toshysVr5us6KlwwRxMnOLK7qLUPdUNahRkysWbiJZqOSDlgq 63uirVCJO0S+qJOgm6QfI0wfJ3hi7nz9F8ujV7/7vw== X-Google-Smtp-Source: ABdhPJwLnjVHv9kqWNAXJHHZUxAgZeGN3nABkUBKLoVXg62pr+US6oGOL0/oKZAaTMwyytU8AZeTPBQ7uIKxZuOEl74= X-Received: by 2002:a05:651c:1af:: with SMTP id c15mr2096875ljn.347.1600800984328; Tue, 22 Sep 2020 11:56:24 -0700 (PDT) MIME-Version: 1.0 References: <20200909215752.1725525-1-shakeelb@google.com> <20200921163055.GQ12990@dhcp22.suse.cz> <20200922114908.GZ12990@dhcp22.suse.cz> <20200922165527.GD12990@dhcp22.suse.cz> <20200922183125.GG12990@dhcp22.suse.cz> In-Reply-To: <20200922183125.GG12990@dhcp22.suse.cz> From: Shakeel Butt Date: Tue, 22 Sep 2020 11:56:13 -0700 Message-ID: Subject: Re: [PATCH] memcg: introduce per-memcg reclaim interface To: Michal Hocko Cc: Minchan Kim , Johannes Weiner , Roman Gushchin , Greg Thelen , David Rientjes , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Andrew Morton , Linux MM , Cgroups , LKML , Yang Shi Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000016, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Sep 22, 2020 at 11:31 AM Michal Hocko wrote: > > On Tue 22-09-20 11:10:17, Shakeel Butt wrote: > > On Tue, Sep 22, 2020 at 9:55 AM Michal Hocko wrote: > [...] > > > So far I have learned that you are primarily working around an > > > implementation detail in the zswap which is doing the swapout path > > > directly in the pageout path. > > > > Wait how did you reach this conclusion? I have explicitly said that we > > are not using uswapd like functionality in production. We are using > > this interface for proactive reclaim and proactive reclaim is not a > > workaround for implementation detail in the zswap. > > Hmm, I must have missed the distinction between the two you have > mentioned. Correct me if I am wrong but "latency sensitive" workload is > the one that cannot use the high limit, right. Yes. > For some reason I thought > that your pro-active reclaim usecase is also not compatible with the > throttling imposed by the high limit. Hence my conclusion above. > For proactive reclaim use-case, it is more about the weirdness of using memory.high interface for proactive reclaim. Let's suppose I want to reclaim 20 MiB from a job. To use memory.high, I have to read memory.current and subtract 20MiB from it and then write that to memory.high and once that is done, I have to set memory.high to the previous value (job's original high limit). There is a time window where the allocation of the target job can hit the temporary memory.high which will cause uninteresting MEMCG_HIGH event, PSI pressure and can potentially over reclaim. Also there is a race between reading memory.current and setting the temporary memory.high. There are many non-deterministic variables added to the request of reclaiming 20MiB from a job. Shakeel