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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 8A39BC4727D for ; Tue, 22 Sep 2020 10:24:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A6522239D2 for ; Tue, 22 Sep 2020 10:24:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="ZtgOaPqm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6522239D2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CB04A900055; Tue, 22 Sep 2020 06:24:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C5F14900036; Tue, 22 Sep 2020 06:24:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B27BC900055; Tue, 22 Sep 2020 06:24:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 9E132900036 for ; Tue, 22 Sep 2020 06:24:48 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 62F5B3623 for ; Tue, 22 Sep 2020 10:24:48 +0000 (UTC) X-FDA: 77290313856.29.ball22_1b0d04f2714d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 396CE18086CA6 for ; Tue, 22 Sep 2020 10:24:48 +0000 (UTC) X-HE-Tag: ball22_1b0d04f2714d X-Filterd-Recvd-Size: 5162 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 10:24:47 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id c2so13647369ljj.12 for ; Tue, 22 Sep 2020 03:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=g5wJkgiy/5FUVTvT1Ox6eVPIWc3NhBDnEL+aZwGUv7Y=; b=ZtgOaPqmXy1A+Gbcwyx2WDHIh7QWWMV6+7AyiGVfXG59CKMLwIW2QZN4PY2kq21Tza H/X+ct31ngIt+7wS3O7ROOUvcaUpup8Dbv+Ly1LggaWmUnBzAqLyYATz2WbmFpkmDrXm AMPTCfrdy03wZTWDdlin2/sp+zqfx0M6mqn28RqJ0HBH7rVGFbcCSyFQ++I3f+wfehPY 52GRZKGV27KnUlbl9VCEdzjFVC8ApeVroVdRtAm9vN8YD9MQPMd1Vgii+dxp/L3CRb1K Z4w4OlZeGH4w6ZbCl6wnq9J76mbtLsbIyGD/DGC9SxxJFiYUYVf0zRrb09OdoNwYEM2e I+lw== 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:content-transfer-encoding; bh=g5wJkgiy/5FUVTvT1Ox6eVPIWc3NhBDnEL+aZwGUv7Y=; b=bBqQ5+JlG/RykMP48QcvpZ2yp7Q460lB/rUAWVg6GR0uXSgve7b9HshocdQ9OWl+tl EfAlHsOuCkDsR/pXH6NE0J/QYshz7lAC21m6b6qllj1x5dXy99l9SGq4tbF6FYrn1o2L nX/9ee8VVKgLEqXoiQ1YkxvgV3l2eIYh2JnkdoEZaH2E2CfBtjlUxYkyaXJmU6aCKYrX l+xg9FUTW89VYPnIfM57HH7L4J/+OnFpIy0OUubJjOkmroYoNENdbPkw9OiNL4uyXIix /KBcPYjCLhfsiXkLjUtpRXTMblL8QUlQAXIl77Ze2cnEE0paHAKMMiFiHtwMoHW0BAGI s+8Q== X-Gm-Message-State: AOAM531OGBH72KVh7yqS34eQn+lZi5Q9WNbkMbKOQBEPPEv9RijUeL1K gmTKy/LCeOIqVBfkY+CWJPY00bXBkhoDPYgCnDtPDw== X-Google-Smtp-Source: ABdhPJxXgZA7Wz+QbkdSrznteFqsjG1l1yak8212eYOgy3YfDUn51qAkpOY4//6idh0NbD3pHLC0kbbYv+E8XlP7zWI= X-Received: by 2002:a05:651c:1203:: with SMTP id i3mr1217853lja.382.1600770286046; Tue, 22 Sep 2020 03:24:46 -0700 (PDT) MIME-Version: 1.0 References: <20200921080255.15505-1-zangchunxin@bytedance.com> <20200921081200.GE12990@dhcp22.suse.cz> <20200921110505.GH12990@dhcp22.suse.cz> <20200922095136.GA9682@chrisdown.name> In-Reply-To: <20200922095136.GA9682@chrisdown.name> From: Chunxin Zang Date: Tue, 22 Sep 2020 18:24:35 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2 To: Chris Down Cc: Michal Hocko , Yafang Shao , Johannes Weiner , Vladimir Davydov , Andrew Morton , Tejun Heo , lizefan@huawei.com, Jonathan Corbet , Alexei Starovoitov , Daniel Borkmann , kafai@fb.com, Song Liu , Yonghong Song , andriin@fb.com, john.fastabend@gmail.com, kpsingh@chromium.org, Cgroups , linux-doc@vger.kernel.org, Linux MM , LKML , netdev , bpf@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Tue, Sep 22, 2020 at 5:51 PM Chris Down wrote: > > Chunxin Zang writes: > >My usecase is that there are two types of services in one server. They > >have difference > >priorities. Type_A has the highest priority, we need to ensure it's > >schedule latency=E3=80=81I/O > >latency=E3=80=81memory enough. Type_B has the lowest priority, we expect= it > >will not affect > >Type_A when executed. > >So Type_A could use memory without any limit. Type_B could use memory > >only when the > >memory is absolutely sufficient. But we cannot estimate how much > >memory Type_B should > >use. Because everything is dynamic. So we can't set Type_B's memory.high= . > > > >So we want to release the memory of Type_B when global memory is > >insufficient in order > >to ensure the quality of service of Type_A . In the past, we used the > >'force_empty' interface > >of cgroup v1. > > This sounds like a perfect use case for memory.low on Type_A, and it's pr= etty > much exactly what we invented it for. What's the problem with that? But we cannot estimate how much memory Type_A uses at least. For example: total memory: 100G At the beginning, Type_A was in an idle state, and it only used 10G of memo= ry. The load is very low. We want to run Type_B to avoid wasting machine resour= ces. When Type_B runs for a while, it used 80G of memory. At this time Type_A is busy, it needs more memory. Usually we will reclaim the memory of B first for Type_A . If not enough, we will kill Type_B.