Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1209830ybt; Tue, 7 Jul 2020 10:06:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhgPGzSdPTvUl1mb7gLg/rq7k5FK0PO1rU2D9EnvjK/Vr61ATGPLLoUf5inPYg0OfukEm8 X-Received: by 2002:a50:a451:: with SMTP id v17mr43529084edb.256.1594141561954; Tue, 07 Jul 2020 10:06:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594141561; cv=none; d=google.com; s=arc-20160816; b=VQWpiyC0VJzXXgJ93M7Sr3THb0yMo2bGiTjSsU9prO4JGXC6HPhREOlv4+ZewA9IyD QPotgRC7uiSigdvlpd2c3behZdsCe5/GfA4D/FqzqrWuv3PzUO9gFoGvfD1QLCeuNSYe 0QHwaER4mJqvT0rnTRCrDXuW1BhPaOUUD0svXs1Kj2tV0i2WIhOk0c0/3QUovVSrWlJm unIaA1G7VpN3qU0rwJHFjqgl4N2lbRMG8w7rkckPqz5KHxuJQVmqQGlgO2pZG1Bjj8/N ZCQNc2U0kuZXxbWKY5QRG5CK2I15fvmGa4TiUYa1mcnKs0bh61RaJmL7FBZgl1ZGzsxO eFyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wWtqhQ1RMjRjpz8jm0pj/37FDxLQZ8+O9P8GTDhdm3U=; b=qNOlFsRnDfqeNaMVCB7Ah4p8/FsYYL7BH2Og33zSjSeYmRZXX6F3ofEW8oykuR0qHW Fe9AlzDeU3pAfq/wRk5+KYrAdrlnA+81RxPTFJ/nouejFzCRsjptD8qQ89ST7xy+CdiL euq3mEw2ubd90PGsd8L+zEq89cOmIDI49BhAPnE4uqybULp9CFzbhD3lvoLU5e7C25rN ymNjw6y9VP1NWmb7lR16FLnDxFgkc17Qi8x0bLVmcxR5kSRT9P9ecSvIrQNBCDpzhe0A EILyRRZqifl2B5fDR5bCjwpb6zkGe7fTSP/PK4doEeJ5gkj2Gh+kMtXDm1c73SsLWnpZ IdYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OOGSMxRh; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u6si15365286ejf.218.2020.07.07.10.05.38; Tue, 07 Jul 2020 10:06:01 -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=@google.com header.s=20161025 header.b=OOGSMxRh; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728182AbgGGRDE (ORCPT + 99 others); Tue, 7 Jul 2020 13:03:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726911AbgGGRDD (ORCPT ); Tue, 7 Jul 2020 13:03:03 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FAD8C061755 for ; Tue, 7 Jul 2020 10:03:03 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id s9so50731714ljm.11 for ; Tue, 07 Jul 2020 10:03:03 -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=wWtqhQ1RMjRjpz8jm0pj/37FDxLQZ8+O9P8GTDhdm3U=; b=OOGSMxRhcoi7zXdpuHNOLamUQAGE/1dJvH57Oa2F7Dps70haKJ/iXRSThoOAl+4HDt fxUVYRoUA639HuyMtcTbnCZxTWFpur1enHcLY1+ZB/a92EhFjm5MZYW7Oq0HKUalGr6i dD8QbODR2513m2AsU5nK7RzbWo62rfxGu9YG6A3Wl8BAp1/uN7OtGoeinAkh7R6J850w oN8H0zGgpLNnOwE+o/kncGTkpwg8SwGs71l4ROffLmqLjjwkmXF5IDwDV+b7x9zm5WLk lkwKAiOezp0G9ojA7UL4URciZn3b0RSBk8z4v+JBUZUqnUvEMklVvRgfZAm8zqvahHrw 1nwg== 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=wWtqhQ1RMjRjpz8jm0pj/37FDxLQZ8+O9P8GTDhdm3U=; b=gO2i2zMZp/vNaoawPNYo0sxpygFdJPG0BPUN8/slAKDIEPmFzWfEjEdmOlVaq7IbcS Rubce0RBS3RQuCERlfAf1oUVNMOo9s5b0Q0M357i6e4P6bb+1M77I48UGdK6B4gXN244 QCE1rVeWrAoiWUtiTeSRMk2ijDIC0FM5T9GtIOGNjFRc8krH6C/0up0BZ/kV7CDudbQT BauJ2/RNnAF81XlYvl0DqIQaGJ6U2JyMhZNvcoHTSFg6ZwT/vK5NOPnBcW1tWfA1HRtk n3nTOqowkx7B9w1m/HJtTukLd4OcIaaVBnurJWufeFTJedUvSYh6DNlSF7pJoLVmp8Cx fLcw== X-Gm-Message-State: AOAM533F7Ep9MXfT+ogGp5Tb2HLc69hSSxb8dHZzPnTjGWfA+3IvTIGm 9btnKeximWiao/4P8lUnutdeDjXtlAYWvX/HTHTsQA== X-Received: by 2002:a05:651c:10f:: with SMTP id a15mr29464307ljb.192.1594141381178; Tue, 07 Jul 2020 10:03:01 -0700 (PDT) MIME-Version: 1.0 References: <20200702152222.2630760-1-shakeelb@google.com> <20200703063548.GM18446@dhcp22.suse.cz> <20200707121422.GP5913@dhcp22.suse.cz> In-Reply-To: <20200707121422.GP5913@dhcp22.suse.cz> From: Shakeel Butt Date: Tue, 7 Jul 2020 10:02:50 -0700 Message-ID: Subject: Re: [RFC PROPOSAL] memcg: per-memcg user space reclaim interface To: Michal Hocko Cc: Johannes Weiner , Roman Gushchin , Yang Shi , David Rientjes , Greg Thelen , Andrew Morton , Linux MM , LKML , Cgroups Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 7, 2020 at 5:14 AM Michal Hocko wrote: > > On Fri 03-07-20 07:23:14, Shakeel Butt wrote: > > On Thu, Jul 2, 2020 at 11:35 PM Michal Hocko wrote: > > > > > > On Thu 02-07-20 08:22:22, Shakeel Butt wrote: > > > [...] > > > > Interface options: > > > > ------------------ > > > > > > > > 1) memcg interface e.g. 'echo 10M > memory.reclaim' > > > > > > > > + simple > > > > + can be extended to target specific type of memory (anon, file, kmem). > > > > - most probably restricted to cgroup v2. > > > > > > > > 2) fadvise(PAGEOUT) on cgroup_dir_fd > > > > > > > > + more general and applicable to other FSes (actually we are using > > > > something similar for tmpfs). > > > > + can be extended in future to just age the LRUs instead of reclaim or > > > > some new use cases. > > > > > > Could you explain why memory.high as an interface to trigger pro-active > > > memory reclaim is not sufficient. Also memory.low limit to protect > > > latency sensitve workloads? > > > > Yes, we can use memory.high to trigger [proactive] reclaim in a memcg > > but note that it can also introduce stalls in the application running > > in that memcg. Let's suppose the memory.current of a memcg is 100MiB > > and we want to reclaim 20MiB from it, we can set the memory.high to > > 80MiB but any allocation attempt from the application running in that > > memcg can get stalled/throttled. I want the functionality of the > > reclaim without potential stalls. > > It would be great if the proposal mention this limitation. > Will do in the next version. > > The memory.min is for protection against the global reclaim and is > > unrelated to this discussion. > > Well, I was talkingg about memory.low. It is not meant only to protect > from the global reclaim. It can be used for balancing memory reclaim > from _any_ external memory pressure source. So it is somehow related to > the usecase you have mentioned. > For the uswapd use-case, I am not concerned about the external memory pressure source but the application hitting its own memory.high limit and getting throttled. > What you consider a latency sensitive workload could be protected from > directly induced reclaim latencies. You could use low events to learn > about the external memory pressure and update your protection to allow > for some reclaim. I do understand that this wouldn't solve your problem > who gets reclaimed and maybe that is the crux on why it is not > applicable but that should really be mentioned explicitly. > The main aim for the proactive reclaim is to not cause an external memory pressure. The low events can be another source of information to tell the system level situation to the 'Memory Overcommit Controller'. So, I see the low events as complementary, not the replacement for the reclaim interface. BTW by "low events from external memory pressure" am I correct in understanding that you meant an unrelated job reclaiming and triggering low events on a job of interest. Or do you mean to partition a job into sub-jobs and then use the low events between these sub-jobs somehow?