Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3816085pxk; Tue, 22 Sep 2020 03:26:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw59MhTdyQHb0/2OEyfEPg+d+mftk0zrgq4kEZUZ+t93SJvaSajCa2Z3SQNT1VXh1fVE+cp X-Received: by 2002:a17:907:685:: with SMTP id wn5mr3946815ejb.285.1600770402847; Tue, 22 Sep 2020 03:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600770402; cv=none; d=google.com; s=arc-20160816; b=iF0uJPbEdIBXRo067RgAOkx3P6HOY0KxDUp+ZzJNBaBeAzBZ6DJdRYwmotIcHiO1Xz 02nMAsECivEK2Adx77LZvfnCdbi7PZ8nuc3iCqweQt5QbUa/7STufrf8fI4AqhL7F681 gS2BSO7At2+3C7iSKuFua+fximCp1LUDHnsMiHdlwcrr2UV9UvYOTomAn+eiLEjrP8g+ pzGM3XMzRP3MRGRudcqqiheVUKNerjLjYWEJglHdWHls+D7CPzE5luw798bsOZNbhfk4 7W2b5gC6Qo8rjBF+8mGaqtDZM2LW7VsMkZ/R3pN13bqf5H8WJoYdMds8G0bvGsDMJ52a LgAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=g5wJkgiy/5FUVTvT1Ox6eVPIWc3NhBDnEL+aZwGUv7Y=; b=gERTz8g25Rjdl3M6d3bdUnEWdFxnEAosIucRK/YMDz9kg2xVOTcJTTMqz9eG0GzXsj u4hDQHai/UdpDqBBNDUkUYxiGRBzbprGkC810dzzp0uqTPC5IjwIaVTAvz1w2iF4DTPF JFtH0rBwPV5oU0foVpYXXz8Yyh8rMAPqDom+GSIzI+yyKAEKAlqtGPhOXoPOCNhGCQ3y xc6dR2eusVuKmUmCEU60GfegX5w62K0BQCO1Q09RSlnz5kUl9yWZKWJHajwLXUH4hiTN OHZlH7fQoI6L8A7HQncMw/9Zy8zAciip3X9G1CqRjw7BVLfK46rWyfFbTi8ATOnsrB6L Qx+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ZtgOaPqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si10437724edx.502.2020.09.22.03.26.19; Tue, 22 Sep 2020 03:26:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ZtgOaPqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726534AbgIVKYs (ORCPT + 99 others); Tue, 22 Sep 2020 06:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbgIVKYs (ORCPT ); Tue, 22 Sep 2020 06:24:48 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC4FBC0613CF for ; Tue, 22 Sep 2020 03:24:47 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id k25so13684597ljk.0 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=R5YuOti3i0o3zTtIuUZx1RVzxxmZ02OlPmq/VLprIfAlONpnPq4wp1SSelaeQj9hfC uOck52uvBy95UKjUCEuTYmtksHEvtSolDK49y07kxt7eucanH8CESq3+ZGb/K+GSztrP vzWXKQtV6XxXFZ2elaRpwc1ndyNqu+9o2YwXkwhBUvUOGRzKyt+Je743bxZNPk5FXCZP Llr1swRFGx1DcKhlHyOEFgQZ002hRMVYNl5NaejT1ilKYBBrCRHNCyn44HKUjuWRbFNQ eGqCgN3SZF6nSBJ31Rt5Ow2/GagzhIp+1+phU5Gk9ld5mPPJyZAXVJv69dV2/KCSIXYU e1+A== X-Gm-Message-State: AOAM533PtEKMR+G5OPuB6BTVfdATwuf7NSnvEZrJmNpmf2Nu+0l9Ivrl UuJ4F41sjfFUHOKECxh2jKrjnwciIeSJsDyWfqCuxg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.