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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 8C93CC433E1 for ; Mon, 17 Aug 2020 16:11:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4ADB7207DE for ; Mon, 17 Aug 2020 16:11:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chrisdown.name header.i=@chrisdown.name header.b="Z23cJzvo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4ADB7207DE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chrisdown.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D486E6B000D; Mon, 17 Aug 2020 12:11:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CF9746B000E; Mon, 17 Aug 2020 12:11:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE6E56B0026; Mon, 17 Aug 2020 12:11:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id A8CF46B000D for ; Mon, 17 Aug 2020 12:11:37 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2FE58181AEF30 for ; Mon, 17 Aug 2020 16:11:37 +0000 (UTC) X-FDA: 77160551034.27.week22_5402a7b27018 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 6EB2F3D669 for ; Mon, 17 Aug 2020 16:11:36 +0000 (UTC) X-HE-Tag: week22_5402a7b27018 X-Filterd-Recvd-Size: 5806 Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Mon, 17 Aug 2020 16:11:35 +0000 (UTC) Received: by mail-qk1-f196.google.com with SMTP id j187so15415482qke.11 for ; Mon, 17 Aug 2020 09:11:35 -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=EPZNWjTuoNbn3/0iITSmRZt5ivNwv7BWW6z1AtL/Hmc=; b=Z23cJzvoZmVLpOK2aT+f4XT4iV2NnQq1w6sWZWEGLYa39+S+I66Qx1sJuEz0lgvGq1 9MafbfOp+fkSCLAdwkxY3sqWfa/7Ya+r03VJzdWTWGLlMGY81AwTZ2a03DaIZWFHcudU YK2AWWX4x4DALRmK9f7+jCQ+8hCmXiM0ppCuA= 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=EPZNWjTuoNbn3/0iITSmRZt5ivNwv7BWW6z1AtL/Hmc=; b=pIFxTM3xVY5oUT7UUlIGlZ/kpX2V1SfvIgQFNKOH8p4c3Ly+7Ews0SDS/o0LT1oxNJ V5H7Qw39xG/Vo8tFsEUxq1ncUoWJRYqauvddWiwsRQedlxfw7iebxiRBfDCLm4OEmyRz PMZiiumVOTcMgQ9AYPDCq5xIE6GgLPYHfBurFkoWIQ5dwvqpvPsMDdzSTkvSwnlMKNqs Snv8ElTzlJiythYYPi/Fk3C/1RUFARbV+gad8f0lL3ogR7PHJvuyY21r1A01+lel7g0b qA44e56IzyykLSQzqZiNmFbnFcwtx0sUUnd+iLPr1uhDFKegr6HlrDQPALG06mTEFO68 K6lw== X-Gm-Message-State: AOAM530GIS7OFnj5z4lTT0LbFW2lQveblXSEv3Xdqm+601xm1Yj69uSz zZREgxB624zWE12dXo/xN5roMg== X-Google-Smtp-Source: ABdhPJxCfcujs7UvLmGxbMeQ2XhvVrOMYp62V16ipQ+dV/Tk0r1zxthxYII+3rcf8N5c4NDp4jS9dg== X-Received: by 2002:a37:9a46:: with SMTP id c67mr13909866qke.85.1597680694869; Mon, 17 Aug 2020 09:11:34 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:47cc]) by smtp.gmail.com with ESMTPSA id z14sm19093304qtn.92.2020.08.17.09.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 09:11:34 -0700 (PDT) Date: Mon, 17 Aug 2020 17:11:32 +0100 From: Chris Down To: Waiman Long Cc: Andrew Morton , Johannes Weiner , Michal Hocko , Vladimir Davydov , Jonathan Corbet , Alexey Dobriyan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH 1/8] memcg: Enable fine-grained control of over memory.high action Message-ID: <20200817161132.GA5171@chrisdown.name> References: <20200817140831.30260-1-longman@redhat.com> <20200817140831.30260-2-longman@redhat.com> <20200817143044.GA1987@chrisdown.name> <934e4bc3-bab6-b19a-49f9-6a6ae8638570@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline In-Reply-To: <934e4bc3-bab6-b19a-49f9-6a6ae8638570@redhat.com> User-Agent: Mutt/1.14.6 (2020-07-11) X-Rspamd-Queue-Id: 6EB2F3D669 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: Waiman Long writes: >On 8/17/20 10:30 AM, Chris Down wrote: >>Astractly, I think this really overcomplicates the API a lot. If=20 >>these are truly generally useful (and I think that remains to be=20 >>demonstrated), they should be additions to the existing API, rather=20 >>than a sidestep with prctl. >This patchset is derived from customer requests. With existing API, I=20 >suppose you mean the memory cgroup API. Right? The reason to use=20 >prctl() is that there are users out there who want some kind of=20 >per-process control instead of for a whole group of processes unless=20 >the users try to create one cgroup per process which is not very=20 >efficient. If using one cgroup per process is inefficient, then that's what needs to= be=20 fixed. Making the API extremely complex to reason about for every user is= n't a=20 good compromise when we're talking about an already niche use case. >>I also worry about some other more concrete things: >> >>1. Doesn't this allow unprivileged applications to potentially=20 >>bypass =A0=A0 memory.high constraints set by a system administrator? >The memory.high constraint is for triggering memory reclaim. The new=20 >mitigation actions introduced by this patchset will only be applied if=20 >memory reclaim alone fails to limit the physical memory consumption.=20 >The current memory cgroup memory reclaim code will not be affected by=20 >this patchset. memory.high isn't only for triggering memory reclaim, it's also about act= ive=20 throttling when the application fails to come under. Fundamentally it's=20 supposed to indicate the point at which we expect the application to eith= er=20 cooperate or get forcibly descheduled -- take a look at where we call=20 schedule_timeout_killable. I really struggle to think about how all of those things should interact = in=20 this patchset. >>2. What's the purpose of PR_MEMACT_KILL, compared to memory.max? >A user can use this to specify which processes are less important and=20 >can be sacrificed first instead of the other more important ones in=20 >case they are really in a OOM situation. IOW, users can specify the=20 >order where OOM kills can happen. You can already do that with something like oomd, which has way more=20 flexibility than this. Why codify this in the kernel instead of in a user= space=20 agent?