Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5088340pxb; Wed, 26 Jan 2022 04:39:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDBsG1CDG+j+/74Y0j2RANjvi6NOmzCsCFCMJ3InsnMxm5jr5wW1Q6JJ5bsJn8Hl26Y+I7 X-Received: by 2002:a63:8a44:: with SMTP id y65mr18286909pgd.423.1643200773877; Wed, 26 Jan 2022 04:39:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643200773; cv=none; d=google.com; s=arc-20160816; b=RjlqrjvwevVWM+J5y8QrMfunuoMKEDzHo4IYH4buGoob/VIyq8hA26u/EE5S9jWTCU 0fTQLfKIdU3X9DVxJlO9VpuF04lmfHRn2sD6cA1W+sAX1BG3ksAWMH9By1XJeWQL03TA iFciIuOjVreSxkxdhqYvACC4kRoVylsQXuqZJXSv6fFxfLrpdf2rxZO9vrCrjBNJxP3j N8N8dp5CCcOCedxEXlMFFSoSpNkaGtIFr7Y1TcvYdTqRSQqv7H+9bsvo/+gL4czZwLeL 8DTJf9PPuihuf6DJEil29CXXLoexRsrb4oo4D3Ul9XmIeZ7u6cD2rQKyS/6cNQAZukeb zFnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=vUEaRvAeqO4wB5ShFfH+VshVtU3ztYzAw/eGT2KcLXg=; b=YkLn8Z0bFoZoBlofxs8pCQyZ4tX2kc/TJwcJ+bKiMCLRKzjf1x0sRnWPKyiDnCuMQx 456YaUAi8j3S+dTAwJvPXz8pIPWoyNRX+lVivhc681g3cfEpH1l0Q8H77ocwrIGmmOPc ye+HU6fI1o25IY8QGcTzASO9W6uOpLToma0E3B/2BjIhIwIDKMp/624HEHzU1eH0iM9y F+CXwWuWu8/aG8zNXfPmvBqrTevqiuGttdrI/xrSnQJUIJ8+oh1mEBXERMDn/ijodZxw Vt2ppO6SWwDvo9m/vDVZmaZiZGISG1r/4QD6fMqzSk5wvkNOgz6Zp6Y7401iK1kSMNSk ledA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=emXX7F+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si2897664pjz.24.2022.01.26.04.39.20; Wed, 26 Jan 2022 04:39:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=emXX7F+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234486AbiAYW6H (ORCPT + 99 others); Tue, 25 Jan 2022 17:58:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234781AbiAYW6G (ORCPT ); Tue, 25 Jan 2022 17:58:06 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DDDEC06161C for ; Tue, 25 Jan 2022 14:58:05 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id x7so59571362lfu.8 for ; Tue, 25 Jan 2022 14:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vUEaRvAeqO4wB5ShFfH+VshVtU3ztYzAw/eGT2KcLXg=; b=emXX7F+vgI8KhnQH9o8EoWDuLk34WEtKEuctbuMWmeiFTDs04Yti6LC1oiu8hvoE0F 6zHK6uDducjGcgdYBRTb/60kK0eZSzL099gOzXGM+UvZ2vcGKri/cniF0gpJYUVnWRea 6dGK8DLP2OcCP90vFMP7G/3sSDZi7vsl0YXErQRmv4pNYTWuvtBLkg0s3XkX0t93bXLX 1OF5dZjc6ezxkmX4OZJavqEQKMXuh+0Jok/FvIWwPv+o/Ck56Z/kEONKFEdFsr8xnxJ3 6kjKUATDq6/IYyps70N9u/r+ZwJx3zo8OXiUl5ue0/cHQkVTBeKKA9HgNz4/nTD/6vmB uMuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vUEaRvAeqO4wB5ShFfH+VshVtU3ztYzAw/eGT2KcLXg=; b=38/doV7Gdp/ktMl7mcV4QDMdsNtgoUlq5TXWVC71fMvv1K5c2CHfjHSKF98nyD1uR/ HJXez4pswiKc+YNwEyX28+7MtFXHNn7Qil/ff6ClW65tfMQdOVb0UF37P3OeYOE8IYTh xKi1smnoueo7Xl7PMRPqyAua9r6eVK4fUkW8xU+a1yYOnrSlFL8vUPcUzkmqQWGTq6ae h/uXwQjGo1jLW4Q3wa32jKshJk5+ZYQRqtqlmZQKEpX8eIyuiLoE+h6+To8akmQeaCjE 3ZmoR2NA8yOzxXzzhiu7ZJReDft+eXZJu3HW5mhRVfKa14OYWt0t0er9zaz8NgD3FiwH YAPQ== X-Gm-Message-State: AOAM531l367CXROLXrEaxeN5l6RqXLUN1hWnc/8oINhaMyK+5vZkD/7g d+KVxmnB8XmTWTFvkLOCCFtMMZwG4Oxqj+hPu+4pCw== X-Received: by 2002:a05:6512:33d5:: with SMTP id d21mr18778383lfg.8.1643151483817; Tue, 25 Jan 2022 14:58:03 -0800 (PST) MIME-Version: 1.0 References: <20220125051736.2981459-1-shakeelb@google.com> <2bec4db-1533-2d39-77f9-bf613fc262d9@google.com> In-Reply-To: <2bec4db-1533-2d39-77f9-bf613fc262d9@google.com> From: Shakeel Butt Date: Tue, 25 Jan 2022 14:57:52 -0800 Message-ID: Subject: Re: [PATCH] mm: io_uring: allow oom-killer from io_uring_setup To: David Rientjes Cc: Jens Axboe , Pavel Begunkov , Andrew Morton , Linux MM , LKML , io-uring@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 10:35 AM David Rientjes wrote: > > On Mon, 24 Jan 2022, Shakeel Butt wrote: > > > 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. > > > > What is the size of the allocations that io_mem_alloc() is doing? > > If get_order(size) > PAGE_ALLOC_COSTLY_ORDER, then this will fail even > without the __GFP_NORETRY. To make the guarantee that workloads are not > receiving ENOMEM, it seems like we'd need to guarantee that allocations > going through io_mem_alloc() are sufficiently small. > > (And if we're really serious about it, then even something like a > BUILD_BUG_ON().) > The test case provided to me for which the user was seeing ENOMEMs was io_uring_setup() with 64 entries (nothing else). If I understand rings_size() calculations correctly then the 0 order allocation was requested in io_mem_alloc(). For order > PAGE_ALLOC_COSTLY_ORDER, maybe we can use __GFP_RETRY_MAYFAIL. It will at least do more aggressive reclaim though I think that is a separate discussion. For this issue, we are seeing ENOMEMs even for order 0 allocations.