Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3793825pxk; Tue, 22 Sep 2020 02:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn/YGQmRpIOEUPLDaaElbq9eYN2g/qP0Tfk5Izjrr0TJpNpD/V5UH8KX4DBba/D4z18RTm X-Received: by 2002:a17:907:2079:: with SMTP id qp25mr3949852ejb.186.1600767922519; Tue, 22 Sep 2020 02:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600767922; cv=none; d=google.com; s=arc-20160816; b=w5Xv5A4jDWraKG7MfkFnprRDAcAj3ZThNPFetg7NYCdghYCdVe3JI22rKSIf7XtmR3 u3q0z9iuUZB5hkNPjvZvlgXJHZ/8cbuCWrpgkurZXf1GU5naiUhHd7EKywSiZ+nOhRS+ B670JXRZ0rmw14hpYIcPjiykMX4V+ycOybnMfTrtCLDb/aN5sMqzWYGaseVXEk662vKD y0TSRTHGA9yt2oFIIKst610nN97p15JJEwrFccJ/lxIfGwn323pQsjWvQvf6w0JtkCKZ 0d7zXRWRt1RCL6I9sUArH5CHZ/0e9RsIUxC8vw6cmt0MO7bIslJQJrW96TVH2EI/F9Qk eFVQ== 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=guVVaBxnWrQ86fDPccANXl4ruP0cfa0fdBrEFJjzk2w=; b=bGju5tiFlCNqpdVyx0kVPDI0YJvN6uNErwXoxH+or5K/AzJt8JPBqkWIjoKH1Z3Q+9 6BJhToa7JyS32Vi8MzU+ly9NgVY4XCZ9790gNO/osMAo7VLzgA4Gh3+IMQ1YMKI+ASjQ TpuWsAcfzMRsq/rUW+qH5chmRRnT2HeaFNfVYHZ9JovovqfM8TXLSpQTrzcYOjhd3lsL b0V1agkU+0b4R8/X7AkK4i0dYoX5x+i2GslrF+/F+kAyYZZ6Boz7I/uY8l/T4xJN9B6D 3W330pDJJUkaICAPuXM0HAI2If0xmvqpN2r3DClZk1Pn0GCD+lB5I0PL2BKM5meNuKDT 2ddw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b="HrhPC/cS"; 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 a9si10204201ejx.166.2020.09.22.02.44.59; Tue, 22 Sep 2020 02:45:22 -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="HrhPC/cS"; 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 S1726543AbgIVJoG (ORCPT + 99 others); Tue, 22 Sep 2020 05:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726461AbgIVJoF (ORCPT ); Tue, 22 Sep 2020 05:44:05 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8192DC0613D0 for ; Tue, 22 Sep 2020 02:44:05 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id r24so13574289ljm.3 for ; Tue, 22 Sep 2020 02:44:05 -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=guVVaBxnWrQ86fDPccANXl4ruP0cfa0fdBrEFJjzk2w=; b=HrhPC/cSVDNvm9kRZbwXzKjP6DTk7b2Nny0qurmlykw8pbZ55EM/YwnTphGw0Phb0i zLX5bT+td8tZrb0mEVN/5fL82j/z07O92s3jT9d8a3W4dm57qRVrcwJUKb/E954BVUFV TFAFWTS9f1YWrkJmJXHSfoOpeRSQND+w5H5Fjv8qHCsv7cOPHBTyoHb2k7c4eymMDFdn 36bHMIDD9tsCIpE+KTz3b5R3eCf65PHRjGW/uP65gLuixUJGJ3T+62IcXjI47ThEu5eZ VV1igHblTySvW9p8oAXIc5QU5B9pDzu/21y96VHJGLYi8awC0gVsJZPlzCzJkQh6mF7V 96iw== 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=guVVaBxnWrQ86fDPccANXl4ruP0cfa0fdBrEFJjzk2w=; b=ZL9no7bKhyprOnTfOZEwplbyRmA0QvO9w/I0LzK3+FO4mz66oIeZCS+9b1eUBUDCVD m6uLs4pnGy1nqpeSG+deIcDyqprnZZU8hhNsXB2zofI9x/jfNXdsx/uETFUFKqXPxI0m 2UouGVDl7IfEV1VQOU6OG5ym/UD5A/z3QZgyqT6HD5LlCp4zDnI0XRsjvXVPRr4r/BAO jLu6oCuoyX/EOgH/3xdQ3v/LzyY84LEpFZr9PQ4MHBNqY+//EjlrIr/Vx6jMYds7BXbI 38BK1+nYviRMgh/FZD23lXSJx0CK736RO56OJOBgGj4ISQFHceOVkKTV3zZorCj8UrSG GPEg== X-Gm-Message-State: AOAM5333F5/SkSj0YYIgak5+1ctTIJ5aiQbiL3AXSSlcrm9ATrdliL4u 4qha6kg8pD+k42nDejlltIwsGdD4I9HsBOD+CDofVA== X-Received: by 2002:a2e:b8d1:: with SMTP id s17mr1198265ljp.222.1600767843752; Tue, 22 Sep 2020 02:44:03 -0700 (PDT) MIME-Version: 1.0 References: <20200921080255.15505-1-zangchunxin@bytedance.com> <20200921081200.GE12990@dhcp22.suse.cz> <20200921110505.GH12990@dhcp22.suse.cz> In-Reply-To: <20200921110505.GH12990@dhcp22.suse.cz> From: Chunxin Zang Date: Tue, 22 Sep 2020 17:43:52 +0800 Message-ID: Subject: Re: [External] Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2 To: Michal Hocko Cc: 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 Mon, Sep 21, 2020 at 7:05 PM Michal Hocko wrote: > > On Mon 21-09-20 18:55:40, Yafang Shao wrote: > > On Mon, Sep 21, 2020 at 4:12 PM Michal Hocko wrote: > > > > > > On Mon 21-09-20 16:02:55, zangchunxin@bytedance.com wrote: > > > > From: Chunxin Zang > > > > > > > > In the cgroup v1, we have 'force_mepty' interface. This is very > > > > useful for userspace to actively release memory. But the cgroup > > > > v2 does not. > > > > > > > > This patch reuse cgroup v1's function, but have a new name for > > > > the interface. Because I think 'drop_cache' may be is easier to > > > > understand :) > > > > > > This should really explain a usecase. Global drop_caches is a terribl= e > > > interface and it has caused many problems in the past. People have > > > learned to use it as a remedy to any problem they might see and cause > > > other problems without realizing that. This is the reason why we even > > > log each attempt to drop caches. > > > > > > I would rather not repeat the same mistake on the memcg level unless > > > there is a very strong reason for it. > > > > > > > I think we'd better add these comments above the function > > mem_cgroup_force_empty() to explain why we don't want to expose this > > interface in cgroup2, otherwise people will continue to send this > > proposal without any strong reason. > > I do not mind people sending this proposal. "V1 used to have an > interface, we need it in v2 as well" is not really viable without > providing more reasoning on the specific usecase. > > _Any_ patch should have a proper justification. This is nothing really > new to the process and I am wondering why this is coming as a surprise. > I'm so sorry for that. 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. > -- > Michal Hocko > SUSE Labs Best wishes Chunxin