From patchwork Mon Sep 10 12:55:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Hocko X-Patchwork-Id: 10594117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25A2F112B for ; Mon, 10 Sep 2018 12:55:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1580228DA5 for ; Mon, 10 Sep 2018 12:55:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0916928FCA; Mon, 10 Sep 2018 12:55:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AC9328DA5 for ; Mon, 10 Sep 2018 12:55:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9A2318E0004; Mon, 10 Sep 2018 08:55:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 951AC8E0001; Mon, 10 Sep 2018 08:55:55 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 840EE8E0004; Mon, 10 Sep 2018 08:55:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 2592A8E0001 for ; Mon, 10 Sep 2018 08:55:55 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id g15-v6so7119821edm.11 for ; Mon, 10 Sep 2018 05:55:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=Bd9LECaHAam54UFLevPF6ExSallEgXO9i/Q16PZdNUE=; b=Nh1isXGXl2Yl/54Hs7VXoVPxhnbZuKNXgWnXVz+4i3DXXE9wtV1VkWVLVv29t15rZD WIrN2YF46lkXJk71tveb23esgliLcEm+3zVQF/7HngFcFYWy8rubZWi6jSz0h5uN2nFO W+EKJHF7RJjoThKBov1B5leVhCNepE6aqKS39sgX7/aRGjlRXtHlT43VtZwj3v1jr7SP YE3sub1jxuADzmz9aZ1Esphkfns7iLgdUiOTIWYpdGiIVOUVCUFohDjcC9/VzeX7uHci JPBDTBABQ0OvXHg7SmPZzHiPcPYck303LdL6hKC0V26uevCQv72SGlZTDblY8VBT5YQk 5AqA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Gm-Message-State: APzg51DcSKItKsK0amesN66bwoKz6wa6S9yUXejUdq1T+vgNDOwp/f5B YpgbYGU0hnxfCDsyYHdWAYjy4pIUO2egl839UJpyOqKAiNitL/5BB9ZF7iG5VBxnTfyLTGK+OAI 3YRg5TYSfSQz6PbPJllSNAy6hsTIQOJ1R/pf/Gix3ShrOk1wk+XyhfwrdXhwfL1W20P06A1/xu0 Kix+QPbpRZfz6CTQ0iW3bxM1U9OygKKnNAvwIMHSvNrg+kwjjv2ZQcPfldDM2moSQeAQRf7xkOc dwL7iRBOQ69x56EALAvTM38tpr0IHPbP+Vxs8pADw+wS7AiG7fbth+qBCxnEALbNr4L7QYf6ck2 xq28AYNe2yKeWLlol6TCOsOG1T+/hIf34N8aAp3l1yKUutysZLCupj0cI2hG/oUSLr5XJugqxQ= = X-Received: by 2002:a50:ac1b:: with SMTP id v27-v6mr23781864edc.260.1536584154612; Mon, 10 Sep 2018 05:55:54 -0700 (PDT) X-Received: by 2002:a50:ac1b:: with SMTP id v27-v6mr23781788edc.260.1536584153674; Mon, 10 Sep 2018 05:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536584153; cv=none; d=google.com; s=arc-20160816; b=On+a0qWQDcCQs945BLFxNNDCYLTa087B20ei4xlcBCXvRDiG03s+GDbFnAuNfwk60T CRoBWsmGoevVZ4V2SjblA873n9dnCJfYE2+jfodYtZ7Iz9SbE8qnI+AaaCreDwf/zAaZ obY9z6RJQsaT28zOlYacTexerrxR+3Z3kbZ+B5pf7reW4tQUboPlX6mse7vdwaYdtWWc gVrAixrdhcxxWdH8Hq79canPURdw92ZHQ6k7d8JFdxrAoV24ARiA8R29qByTpRxwpgss aAfasKcvh9Hh2Co+zcw6z/+QQUlXzfACiFWYKBmWyvMNytPVp4FryxgacMFVN9bZUR/r jR4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=Bd9LECaHAam54UFLevPF6ExSallEgXO9i/Q16PZdNUE=; b=eZoE1SShP/Gvc30GZuwmzw0AAv3fj487YS74i/I4YXZLKbsxbcPwUPY8tweRqlZZJM MqoTcTUO4cF82KkqmwpnStEkx8/LPQVLhTnXiyhV9u82Ys4FeTpP32WbkXL7zbtvw9Er evkrFdJtM8BBKBVzlpddBE2uI3R7mzoh6KyeDBIeCGOPYzCh9fDwszOSlpFporntVU5z IMnKi1efPcYkPnGuLQXXqdL0MYpWDMCf1YH2UEXYt1TAUFWJHeNNkA2g+/VxLoPzlV1P xziYQ44zlB4RLpOzeqmD2rEXpCVFTFj3EMsXCfKVwEk2f5sITi2wM2pobFnf1COpLdr8 z7jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v50-v6sor14916499edm.17.2018.09.10.05.55.53 for (Google Transport Security); Mon, 10 Sep 2018 05:55:53 -0700 (PDT) Received-SPF: pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mstsxfx@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=mstsxfx@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Google-Smtp-Source: ANB0VdZCFwDHvKyFRxM4Hb3SQB8/dyH/122JReGE8wk/TDAm2H+J2wsnNtciwLOm/l8PXWrrMXqTLA== X-Received: by 2002:aa7:d5cd:: with SMTP id d13-v6mr23389539eds.161.1536584153057; Mon, 10 Sep 2018 05:55:53 -0700 (PDT) Received: from tiehlicka.suse.cz (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id h40-v6sm8632245edh.88.2018.09.10.05.55.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 05:55:51 -0700 (PDT) From: Michal Hocko To: Cc: Tetsuo Handa , Roman Gushchin , Andrew Morton Subject: [RFC PATCH 0/3] rework mmap-exit vs. oom_reaper handover Date: Mon, 10 Sep 2018 14:55:10 +0200 Message-Id: <20180910125513.311-1-mhocko@kernel.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <1536382452-3443-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> References: <1536382452-3443-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> 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: X-Virus-Scanned: ClamAV using ClamSMTP I am sending this as a follow up to yet-another timeout based proposal by Tetsuo because I was accused that I am pushing for a solution which I am not working on. This is a very coarse implementation of the idea I've had before. Please note that I haven't tested it yet. It is mostly to show the direction I would wish to go for. I have already explained why I hate timeout based retry loop and why I believe a more direct feedback based approach is much better. The locking protocol between the oom_reaper and the exit path is as follows. All parts which cannot race should use the exclusive lock on the exit path. Once the exit path has passed the moment when no blocking locks are taken then it clears mm->mmap under the exclusive lock. It is trivial to use a MMF_$FOO for this purpose if people think this is safer or better for any other reason. The oom proper is the only one which sets MMF_OOM_SKIP with these patches which is IMHO better because it is much easier understand the interaction this way. Last but not least, this is a core of the implementation. We might want to tune the number of oom_reaper retries or to think about a more effective tear down when there are multiple oom victims in the queue. I would simply care about those later once we see a clear evidence that this is needed. Ideally with a workload description and some numbers. If this looks like a feasible idea I can spend on this more time and turn it into something meargable.