Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4406626pxb; Mon, 21 Feb 2022 20:33:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7+V6VqdlH8zjnJsr8yULiWXAoCfTTeJYsJ3NYQjJmBbMK2YdM55Y+CnDemXP2W7Te4sSk X-Received: by 2002:a17:90a:bf8f:b0:1bc:4ae6:e009 with SMTP id d15-20020a17090abf8f00b001bc4ae6e009mr2214777pjs.127.1645504431633; Mon, 21 Feb 2022 20:33:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645504431; cv=none; d=google.com; s=arc-20160816; b=P7AUtWCWvRFnqbiRdLfzqxIC45+mC36Q+zF7V77l0ZZ6oJ72Z5MEXa81jNCfZQK1qe /4WMe7jsI+8CqcspFVsBsnnJeECa1jHaKpdBtsZNdJ5F/vbMlWjXBIf5ECGPGG3oTeEC ofSmIX0XEHfrvRQiA3AVjuYk7EteR3bOeOaG9Ek6mbyQ80PnBxvtpU/ALU2fYbC3QWb4 BqAQq+rcqxL+7pqT//eMe5KN7jL+SHKrb7LyOx88gT3lpNjAABRxmMzQx0aGRcWhYQfh CXb3jWgq4rhuxij3Dc0q8rJ5m845dpVrOneiv2aROnA/XSsu0d6EGmRFluPKFUeaLFJK 8FYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NPxXvFu8JvdLWb7mgZ/4kmTFyYj6yxoFYc1bBNIN9VU=; b=p7KvmVaxA0hnbOPrVY65klG0b4ixiRoWvnFMw1Enp37NDxWCZeKKaa6FZRYnYiQA30 QTBCBBkF9rEJEFbx5xl2bd+pqHTXhb9sGIKCLtNWvU7xSeCa4ZOIhtQ0kfXWqz7FqyRk GQeQ0n8l8UOmPgsL5grwBDPRilSUgqHa2+5Amu+l2xUNdXOIZlMMVSLK/Xe48027yMet f6Ybq4H+ZnWfUc+GARNuiI2QTTixnIAV8RQe6bhIK9kxTOh3vjEkI0LbHQ6668URXT0g 8DccH+czcvCJEG0H3YBiNkC61JMSblGKeqEVYgKKLJAxSIha6G6Ls3SX5mkqNAz9ns/u tDSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTjbeO7u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id n12-20020a17090aab8c00b001b9fffaf02asi1045490pjq.165.2022.02.21.20.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 20:33:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DTjbeO7u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CFACAE0C2; Mon, 21 Feb 2022 20:22:18 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352403AbiBUKFH (ORCPT + 99 others); Mon, 21 Feb 2022 05:05:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353499AbiBUJ53 (ORCPT ); Mon, 21 Feb 2022 04:57:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D3411DA43; Mon, 21 Feb 2022 01:26:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 36883B80EB9; Mon, 21 Feb 2022 09:26:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 648EFC340E9; Mon, 21 Feb 2022 09:26:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435582; bh=NlYiKCzMphCEljHl8byhWKGsGFsOAvjFrsw6xUZdgSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTjbeO7u7bfkFWk0p1luxbIJD5KDZl08mh2ekwIxtBJSjm6aQhokeC5n+SnS1DsUM o4YMmEjVmTIejcnOtCOWWAXZiZ+CZ3avWoEdpIsfgJ2qAJeaw6B0Dg1l6Yno9A3fC0 x25Uj7I2mwKSCiAtKkRDv45V9ycauXnJ6Kj6djbM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shakeel Butt , Jens Axboe , Sasha Levin Subject: [PATCH 5.16 213/227] mm: io_uring: allow oom-killer from io_uring_setup Date: Mon, 21 Feb 2022 09:50:32 +0100 Message-Id: <20220221084941.900619489@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shakeel Butt [ Upstream commit 0a3f1e0beacf6cc8ae5f846b0641c1df476e83d6 ] 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 Link: https://lore.kernel.org/r/20220125051736.2981459-1-shakeelb@google.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- 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 698db7fb62e06..a92f276f21d9c 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8872,10 +8872,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, -- 2.34.1