From patchwork Tue Jan 25 05:17:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 12723296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B6DAC433EF for ; Tue, 25 Jan 2022 05:18:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 777766B0081; Tue, 25 Jan 2022 00:18:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 726E16B0083; Tue, 25 Jan 2022 00:18:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 615A06B0085; Tue, 25 Jan 2022 00:18:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 3149E6B0081 for ; Tue, 25 Jan 2022 00:18:01 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6CF5B1842C4B3 for ; Tue, 25 Jan 2022 05:18:00 +0000 (UTC) X-FDA: 79067652720.05.6012EDA Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf29.hostedemail.com (Postfix) with ESMTP id 0BA96120004 for ; Tue, 25 Jan 2022 05:17:59 +0000 (UTC) Received: by mail-pl1-f202.google.com with SMTP id e3-20020a170902ed8300b0014b46561c92so2070102plj.15 for ; Mon, 24 Jan 2022 21:17:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=Ocy1f8e8l5tnDktp3A5HwcgpUMQpU1wPRyfhdTDw5M8=; b=VeHwN5GkQbTg4xXyCkEkUwiJWbtdR+uqWnLLC+h4ovZG0cDZTJcvgJIH2cBuR1bq/z k+hrJ7P+DlciIwsI/fEaKDEwZan3zTiRMxn5AE3MW2Kqp8OauhOn/pkI0mA1UjkWnTFm diE1GSsMVdImczBIfjkOnOLAiUiVdFxrWlAMOgJprfvVLmsaVyZD8LBDJp/J6+QWxfFA EEAqgOVm7jfqtvD5PS8JkwyHDco7E32xgfm85lhcGhUajCeP4FVyE64zuCKLKG7TytbE pYakrcdz72KFPOKsz1d3RJsonbFJVmLkvYDsdmqW4rNRDr20wfwybVVPUZsZUKe4TUfd gSEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=Ocy1f8e8l5tnDktp3A5HwcgpUMQpU1wPRyfhdTDw5M8=; b=e3uyQ4yU5VY8HIUETnxO4CMCl0Z8Vg/kEuAVxMJtujdZ6QjottdhrfpucQn7VGwO6S GffpfEYj7TRYi3P95BoKc65HDxJ/qXoEoZLjtlM6Ldt6HPAH7HRjBk/k8f+XMQHs2SJA mAKzkDsaY71RtBhIK/9RjgLxA4IzEP8Ddy0peGclfE+RYhLiKNH+en9bluImbvzK9YpW OejlH/gUsIW0Rw2QBofstokJmCbO36sKfUgOFA1zPkS0Fq7DO1WOLJpc5Z8DgWP/YWDf Gh18oF7IGK34ggPMHC4QfGvdOM/WUNrZSVOA/Bd95lOKqN7SsULZ0RJuxbwbPSS3f8jX nqTw== X-Gm-Message-State: AOAM531H88P/HspIo1YNPLMC6nNKxmuV+16bZNyxugWQYWGrvlwHFnfv K4T3qsE05fNqxymcWSrAoEzRnEShEmDUIg== X-Google-Smtp-Source: ABdhPJxe8AfKsCPhuglY9hr0mXjNrX0aldbMm31sCb7LADfE3npZOHRYWdmErVF1V2X6jR/3AHWfOJIeO4t9vQ== X-Received: from shakeelb.svl.corp.google.com ([2620:15c:2cd:202:276f:dcd0:a2cf:ec4c]) (user=shakeelb job=sendgmr) by 2002:a17:902:ab82:b0:14a:188a:cd1f with SMTP id f2-20020a170902ab8200b0014a188acd1fmr17395057plr.44.1643087878415; Mon, 24 Jan 2022 21:17:58 -0800 (PST) Date: Mon, 24 Jan 2022 21:17:36 -0800 Message-Id: <20220125051736.2981459-1-shakeelb@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog Subject: [PATCH] mm: io_uring: allow oom-killer from io_uring_setup From: Shakeel Butt To: Jens Axboe , Pavel Begunkov Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, Shakeel Butt Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=VeHwN5Gk; spf=pass (imf29.hostedemail.com: domain of 3BojvYQgKCOkdSLVPPWMRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--shakeelb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3BojvYQgKCOkdSLVPPWMRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--shakeelb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: nil X-Rspamd-Queue-Id: 0BA96120004 X-Stat-Signature: jh67s7dadn8qfpbe16grjzuo78cukcfb X-Rspamd-Server: rspam12 X-HE-Tag: 1643087879-446881 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 an overcommitted system which is running multiple workloads of varying priorities, it is preferred to trigger an oom-killer to kill a low priority workload than to let the high priority workload receiving ENOMEMs. On our memory overcommitted systems, we are seeing a lot of ENOMEMs instead of oom-kills because io_uring_setup callchain is using __GFP_NORETRY gfp flag which avoids the oom-killer. Let's remove it and allow the oom-killer to kill a lower priority job. Signed-off-by: Shakeel Butt --- fs/io_uring.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index e54c4127422e..d9eeb202363c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8928,10 +8928,9 @@ static void io_mem_free(void *ptr) static void *io_mem_alloc(size_t size) { - gfp_t gfp_flags = GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN | __GFP_COMP | - __GFP_NORETRY | __GFP_ACCOUNT; + gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO | __GFP_NOWARN | __GFP_COMP; - return (void *) __get_free_pages(gfp_flags, get_order(size)); + return (void *) __get_free_pages(gfp, get_order(size)); } static unsigned long rings_size(unsigned sq_entries, unsigned cq_entries,