Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3825439pxk; Tue, 22 Sep 2020 03:44:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0Mr+4E9uAbySmhBEW+HedUUwomy3tENokwOMNXimtZLdLsPlOFb0VEoXrLfQqdFS4+W/b X-Received: by 2002:a17:906:4754:: with SMTP id j20mr4302168ejs.293.1600771459987; Tue, 22 Sep 2020 03:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600771459; cv=none; d=google.com; s=arc-20160816; b=ah8aZU2elzJCKwnzTBWTn5BmRvCEujsdNAhXfJfc+MpToHwJbQvB2LyiVJzJV1T4UG ctLjw8MBZlYd95nf9npnH8j5cT6yzoLkP+FX0auXuXDOrrTq+IOkoCtHkCjpM+75KjSB W1DwOpS37b4et0mGjT1mtIRliWM9BFH30QpnDr1R+V9NBRYcApF9pRnEfjAuyRTv3mna BY7XoUJS5CGJNui5vbxBPtw/67qEbFimoGtrX4UHH0cXK+UKLcTMQzZCXIequ0KzZD73 3OcQW+LbRxdURgEU5fD9ELgDFS/deyXQEHms451N4NU11EFxHyE+QzOlpjmp2PMG/vep i68Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=d1+yTgS/nDdjZEJi5XLFsbasjOospBGkZinpc5mGS48=; b=LW0vExukW9NJtzFpg7uDR7yzqpFiAQJve+x/8IiG8XjjXZygbgmgPdeLu5Pjnoglnd A2QcDU4ct9X/FQd21e/vlNv2e8c0ou29VtHVpzrhL1pGFyOlenxzeWcUC1pB5x8tmU9x Ll/PlM2ND9Miffe0pEohwe94uTNFzkvIwWsD7KrDsztrZC0za2mzV7VMNR+YKlQ7W7C1 rlgqCvPUh+coNl0Pn5V2lWHE4gnL3aRsHSXeqyGfsZN8sDLKX6/YQWQkAgK/PegRGD8E gt0aDlOqRDIXKOYVziIlaoF5RWBLToTmFbz3odop3d7kJwnyyJgmtIA0N+yIwCpTG0zC hqzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=NTQO2+kj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fy6si10068003ejb.603.2020.09.22.03.43.56; Tue, 22 Sep 2020 03:44:19 -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=@chrisdown.name header.s=google header.b=NTQO2+kj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbgIVKmz (ORCPT + 99 others); Tue, 22 Sep 2020 06:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726515AbgIVKmz (ORCPT ); Tue, 22 Sep 2020 06:42:55 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8257C0613D1 for ; Tue, 22 Sep 2020 03:42:54 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id e22so15704131edq.6 for ; Tue, 22 Sep 2020 03:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=d1+yTgS/nDdjZEJi5XLFsbasjOospBGkZinpc5mGS48=; b=NTQO2+kjCrvdbjEFL+8qa0xnM8j2aFkI4YIcOCf4DCtwzIrmLrmov9WqKk+Wh+vi4c gCqSG+yI5jbUdW0ZVX5erknsxE3avoRsk7dEgDoLscAWzHi9kia5w25FMnOnzVtYelst N+N+jIm2n4VgPnzMfUEdrh/Ou7cDYiyq+cqLg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=d1+yTgS/nDdjZEJi5XLFsbasjOospBGkZinpc5mGS48=; b=FKw6DwLG/1w3h/+QdsPd6WroHIzfpA4J93vTnLZmi6ffVi0xKGu7LwlAS2QxBIvOIZ LqkvXkPQwaWWxBGreEdoatUnlVQkFABpinUBTcLrcqpzWMSh/gfQ4EU4I/43eUm9TCkW 9fxKBu9wS4z5u6SJLcMcGnRgT9uj+wn4c16BFGfRKcXjBGLAdMHFciqvGqd1zcyTb193 TPCRc5ywRetFBgJt3C+oe25/VN/VtQlut7haRh3fv/2Dm2ZZjdjww8Mm8yR5fYlGvhFo XF1hmaOTSkM08dVxxtMis9e22APVzI1V5ZgQaDFfYvxGVcJ2vPp+RuRPthITsFSkA7bI QsEw== X-Gm-Message-State: AOAM533PtMwDoGMoC+IfTZW8FfcMbgi1Lh3YVa8nDNvnwi/toj4hwnPP I0z0ytFuTqLxEV9BWAddXErXKw== X-Received: by 2002:a05:6402:202a:: with SMTP id ay10mr3317444edb.36.1600771373203; Tue, 22 Sep 2020 03:42:53 -0700 (PDT) Received: from localhost ([2620:10d:c093:400::5:7783]) by smtp.gmail.com with ESMTPSA id 16sm10724717edx.72.2020.09.22.03.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 03:42:52 -0700 (PDT) Date: Tue, 22 Sep 2020 11:42:52 +0100 From: Chris Down To: Chunxin Zang 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 Subject: Re: [External] Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2 Message-ID: <20200922104252.GB9682@chrisdown.name> References: <20200921080255.15505-1-zangchunxin@bytedance.com> <20200921081200.GE12990@dhcp22.suse.cz> <20200921110505.GH12990@dhcp22.suse.cz> <20200922095136.GA9682@chrisdown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.14.7 (2020-08-29) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Chunxin Zang writes: >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、I/O >> >latency、memory 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 pretty >> 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. memory.low allows ballparking, you don't have to know exactly how much it uses. Any amount of protection biases reclaim away from that cgroup. >For example: >total memory: 100G >At the beginning, Type_A was in an idle state, and it only used 10G of memory. >The load is very low. We want to run Type_B to avoid wasting machine resources. >When Type_B runs for a while, it used 80G of memory. >At this time Type_A is busy, it needs more memory. Ok, so set memory.low for Type_A close to your maximum expected value.