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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 E70CEC432BE for ; Mon, 2 Aug 2021 20:08:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1E76610FB for ; Mon, 2 Aug 2021 20:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbhHBUI4 (ORCPT ); Mon, 2 Aug 2021 16:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbhHBUIz (ORCPT ); Mon, 2 Aug 2021 16:08:55 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82232C061760 for ; Mon, 2 Aug 2021 13:08:44 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id x192so30488269ybe.0 for ; Mon, 02 Aug 2021 13:08:44 -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=YxYj5zYVZBv3JoffDNb2oh5CmT3tQ9PMXwExh030AyY=; b=gAPpLlsnvFmwBUS/RotmADz0y1jFOql5yavKhcCuzzhLGTP773gam1KzfrZLjUiUYO vrAdGUXVwwnk8xF6hSlYaZJU5HSNoWJtsrFGI53HS/FHYIy8Hno1yff7dhDKmQeyunHV f28TBibGXlCmbZuBlJ8rmpIJZPLbsIxxPPsrmRK4lqEEgLeX/8aC67V01aohnUg+Jc7T iKlXYtFeVY1IJkCXrxJnd6mljaBfHQpRuS89jLXqDs/tI50kmbOBR3bLyxdG4zJtS2qZ y0BpBof9eCh/YBq1qLt/IJliATGCMu/M4cdho12OVjzlmqq48CkKt562vpTPlwBxHyxE hn6Q== 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=YxYj5zYVZBv3JoffDNb2oh5CmT3tQ9PMXwExh030AyY=; b=AhVmeK9uLSExno5AAf9zVJ3d4laVihGmRyD6kO2QtzoYsW2i87PaVYRWXtK57bBORC yHUQQIxdRpoQmi559QCWjDcAJdYq9butx4nv4H5FrZKbNNVx8fYhKs1LxLHcGFcdTXdL DVR5rqJ+DKldS84z2aE+0HElnyJ0ZQ4Yj5Q3Dbl0wIzYsWP5DJcQ8VM8cVgklruZ7D5g +pKuYM/df/jgX2FC9fRj8MvGBxoEDtjEWjfTA56jPEbcTEhJBL9WxRrTqshrbRqNkV0q 9H8V+T8I93KVcyBO+SYHveMWzKrgIRuFvV0ZGCd59LPvKG10gJZcmUOFe1yHoBqQBhwi iQOw== X-Gm-Message-State: AOAM5334UdqC0TH3hbMDVkEz/ePjgyxXIa2SwGdulpEXa+b6097xlrB5 Ad9j+Y/50id2efQI8T7pcRzhmye/+xEZb7O4DbG64g== X-Google-Smtp-Source: ABdhPJw9JDr+e+SrPj7jJ/TgU+U9CAwlGhl01CB2D6tdPsR4tGrBGm8zKZFdiwctNmPUMtVoabAkddYuwkdLfCl+uXw= X-Received: by 2002:a25:9ac6:: with SMTP id t6mr23179320ybo.190.1627934923594; Mon, 02 Aug 2021 13:08:43 -0700 (PDT) MIME-Version: 1.0 References: <20210723011436.60960-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 2 Aug 2021 13:08:32 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] mm: introduce process_mrelease system call To: Shakeel Butt Cc: Michal Hocko , Andrew Morton , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , David Hildenbrand , Jann Horn , Andy Lutomirski , Christian Brauner , Florian Weimer , Jan Engelhardt , Tim Murray , Linux API , Linux MM , LKML , kernel-team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 2, 2021 at 1:05 PM Shakeel Butt wrote: > > On Mon, Aug 2, 2021 at 12:54 PM Suren Baghdasaryan wrote: > > > > On Mon, Jul 26, 2021 at 6:44 AM Shakeel Butt wrote: > > > > > > On Mon, Jul 26, 2021 at 12:27 AM Michal Hocko wrote: > > > > > > > [...] > > > > > > > > Is process_mrelease on all of them really necessary? I thought that the > > > > primary reason for the call is to guarantee a forward progress in cases > > > > where the userspace OOM victim cannot die on SIGKILL. That should be > > > > more an exception than a normal case, no? > > > > > > > > > > I am thinking of using this API in this way: On user-defined OOM > > > condition, kill a job/cgroup and unconditionally reap all of its > > > processes. Keep monitoring the situation and if it does not improve go > > > for another kill and reap. > > > > > > I can add additional logic in between kill and reap to see if reap is > > > necessary but unconditionally reaping is more simple. > > > > > > > > > > > > An alternative would be to have a cgroup specific interface for > > > > > reaping similar to cgroup.kill. > > > > > > > > Could you elaborate? > > > > > > > > > > I mentioned this in [1] where I was thinking if it makes sense to > > > overload cgroup.kill to also add the SIGKILLed processes in > > > oom_reaper_list. The downside would be that there will be one thread > > > doing the reaping and the syscall approach allows userspace to reap in > > > multiple threads. I think for now, I would go with whatever Suren is > > > proposing and we can always add more stuff if need arises. > > > > > > [1] https://lore.kernel.org/containers/CALvZod4jsb6bFzTOS4ZRAJGAzBru0oWanAhezToprjACfGm+ew@mail.gmail.com/ > > > > Hi Folks, > > So far I don't think there was any request for further changes. > > Anything else you would want me to address or are we in a good shape > > wrt this feature? > > If so, would people who had a chance to review this patchset be > > willing to endorse it with their Reviewed-by or Acked-by? > > I think with Michal's suggestion to use a killable mmap lock, at least > I am good with the patch. Ah, yes. Thanks for pointing this out! I'll replace mmap_read_lock() with mmap_read_lock_killable(). Will post an updated version later today. 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=-13.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 6825CC4338F for ; Mon, 2 Aug 2021 20:08:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0A9F610A8 for ; Mon, 2 Aug 2021 20:08:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F0A9F610A8 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 602476B0033; Mon, 2 Aug 2021 16:08:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58B546B0036; Mon, 2 Aug 2021 16:08:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 42BC08D0001; Mon, 2 Aug 2021 16:08:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 287756B0033 for ; Mon, 2 Aug 2021 16:08:45 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C5FE08249980 for ; Mon, 2 Aug 2021 20:08:44 +0000 (UTC) X-FDA: 78431228568.01.B02E196 Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by imf28.hostedemail.com (Postfix) with ESMTP id 6E24C9002F38 for ; Mon, 2 Aug 2021 20:08:44 +0000 (UTC) Received: by mail-yb1-f169.google.com with SMTP id e4so16781968ybn.2 for ; Mon, 02 Aug 2021 13:08:44 -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=YxYj5zYVZBv3JoffDNb2oh5CmT3tQ9PMXwExh030AyY=; b=gAPpLlsnvFmwBUS/RotmADz0y1jFOql5yavKhcCuzzhLGTP773gam1KzfrZLjUiUYO vrAdGUXVwwnk8xF6hSlYaZJU5HSNoWJtsrFGI53HS/FHYIy8Hno1yff7dhDKmQeyunHV f28TBibGXlCmbZuBlJ8rmpIJZPLbsIxxPPsrmRK4lqEEgLeX/8aC67V01aohnUg+Jc7T iKlXYtFeVY1IJkCXrxJnd6mljaBfHQpRuS89jLXqDs/tI50kmbOBR3bLyxdG4zJtS2qZ y0BpBof9eCh/YBq1qLt/IJliATGCMu/M4cdho12OVjzlmqq48CkKt562vpTPlwBxHyxE hn6Q== 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=YxYj5zYVZBv3JoffDNb2oh5CmT3tQ9PMXwExh030AyY=; b=sI62iwitHYy/EAVUtwvMCsansuN+Nfk1XcoTq0KDMrc0A5x26YsR4pYAD92p8iU3aM fJoN1s/U1/m7i+crJzisKnDdNHx/9MR17SOM0jfLMMdaPgJQHxZWTMzwWh70WM/IW82i Ep3vtpIAzm9udYZ5u7UF2wj2kaeTwph8937IRhJ4W0iUHk3ag1SinO/ZE7+UmJzVeupJ culuSUQMKqi7IWnYv8ljlicsWHfN7GTDt5Bs9mxeN/99lsqjMAa/vk/ai3cAjY8CZmqy MTQOcJrOvWRzpqx72MJCH84Uc2fUd43EJcnLzmYNDwVWCUd6jOyryPfgQ/InmVBT8LHx n8/A== X-Gm-Message-State: AOAM530k9sSrU2VpDB+qVT1Ugg2HXcxgC16KpUpjhRX1SfsOAfO6r77j YpvsTgxksL4p0FosLiLggPeiyxaiRuHlOYdlXY9Y5w== X-Google-Smtp-Source: ABdhPJw9JDr+e+SrPj7jJ/TgU+U9CAwlGhl01CB2D6tdPsR4tGrBGm8zKZFdiwctNmPUMtVoabAkddYuwkdLfCl+uXw= X-Received: by 2002:a25:9ac6:: with SMTP id t6mr23179320ybo.190.1627934923594; Mon, 02 Aug 2021 13:08:43 -0700 (PDT) MIME-Version: 1.0 References: <20210723011436.60960-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 2 Aug 2021 13:08:32 -0700 Message-ID: Subject: Re: [PATCH v3 1/2] mm: introduce process_mrelease system call To: Shakeel Butt Cc: Michal Hocko , Andrew Morton , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , David Hildenbrand , Jann Horn , Andy Lutomirski , Christian Brauner , Florian Weimer , Jan Engelhardt , Tim Murray , Linux API , Linux MM , LKML , kernel-team Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=gAPpLlsn; spf=pass (imf28.hostedemail.com: domain of surenb@google.com designates 209.85.219.169 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6E24C9002F38 X-Stat-Signature: 337jkt6whgiysj5bt93t9q4s56muq86d X-HE-Tag: 1627934924-534442 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: On Mon, Aug 2, 2021 at 1:05 PM Shakeel Butt wrote: > > On Mon, Aug 2, 2021 at 12:54 PM Suren Baghdasaryan wrote: > > > > On Mon, Jul 26, 2021 at 6:44 AM Shakeel Butt wrote: > > > > > > On Mon, Jul 26, 2021 at 12:27 AM Michal Hocko wrote: > > > > > > > [...] > > > > > > > > Is process_mrelease on all of them really necessary? I thought that the > > > > primary reason for the call is to guarantee a forward progress in cases > > > > where the userspace OOM victim cannot die on SIGKILL. That should be > > > > more an exception than a normal case, no? > > > > > > > > > > I am thinking of using this API in this way: On user-defined OOM > > > condition, kill a job/cgroup and unconditionally reap all of its > > > processes. Keep monitoring the situation and if it does not improve go > > > for another kill and reap. > > > > > > I can add additional logic in between kill and reap to see if reap is > > > necessary but unconditionally reaping is more simple. > > > > > > > > > > > > An alternative would be to have a cgroup specific interface for > > > > > reaping similar to cgroup.kill. > > > > > > > > Could you elaborate? > > > > > > > > > > I mentioned this in [1] where I was thinking if it makes sense to > > > overload cgroup.kill to also add the SIGKILLed processes in > > > oom_reaper_list. The downside would be that there will be one thread > > > doing the reaping and the syscall approach allows userspace to reap in > > > multiple threads. I think for now, I would go with whatever Suren is > > > proposing and we can always add more stuff if need arises. > > > > > > [1] https://lore.kernel.org/containers/CALvZod4jsb6bFzTOS4ZRAJGAzBru0oWanAhezToprjACfGm+ew@mail.gmail.com/ > > > > Hi Folks, > > So far I don't think there was any request for further changes. > > Anything else you would want me to address or are we in a good shape > > wrt this feature? > > If so, would people who had a chance to review this patchset be > > willing to endorse it with their Reviewed-by or Acked-by? > > I think with Michal's suggestion to use a killable mmap lock, at least > I am good with the patch. Ah, yes. Thanks for pointing this out! I'll replace mmap_read_lock() with mmap_read_lock_killable(). Will post an updated version later today.