Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6347623pxb; Wed, 17 Feb 2021 01:55:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIwwGZ9ez+cYXzR6RlY/gHvbngZPk/c6g6Rw8RX+6+L6iZqAiK6hn4GZOODkFFXZI3oGCa X-Received: by 2002:aa7:cd51:: with SMTP id v17mr23373046edw.194.1613555724875; Wed, 17 Feb 2021 01:55:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613555724; cv=none; d=google.com; s=arc-20160816; b=KieEx5wEGHID6zw7SGWZByZ/Wd0Zt4HRT/CSGllO8P1r8Mo8/k1MKjnHOTBbPGx7Lo /h8Zt77xKEYYm7hEa0Gc181RPkfk81Kpx3stKkxhmfS7mXE/bruEWV/yIf8xpIsVi6E2 mfbhsK33eDt3Hv00IXaBKaObU0Dr4NHFxUwCbpdYWCDirzlBvc9ZGgMAgnGoijIooE9N cXSL+38rYN3vRiFtP4zzWZBcnW4UTtZCCGGP/nNh6AFk6sgxlvuQEJFvlUxhIIaRppEU uflcWM3YasaX8f9jamDDCNuoBqaIhoMUPP8IkVTQ+OHAvc39bAXPLEUl9/9k25HQLQTj IGsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature; bh=RFusShBhS4qAoH9QAhjf7bQvV8GQfYBBL88bdpAsQow=; b=iY8rp028SNiNDlGDgXvWHnh/HSSfSyimcs4vUhMexZRi1yPPtT04xeC3m7wTKdxPFo DmjeGqEbEALHhJ117ggUokS7tAlwXazZi3DIz2fdFDi9uJvMMHqyS2aqM2TGi1BYdPST Dwv3gcO3LiSrt3Km7EyXoCn3DR5Fr1sTRHbJ6zgDk4h6PDhm3eeZfAgAjSor7SZNVik6 eBQQ8amCzvN27NhoBtkG8/lwooJx1qp10NZ/q6i1G9Zz0ErentTnOvR3zwz+x649fIH4 OEv+vcYPcIslPh4+YQLEAk4OrEXcgImSeecDnP8gaGJoQkX11Vlm+SEkLPqEBU3dZkll 6SWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=h0WXDLKY; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n7si670600ejs.437.2021.02.17.01.55.01; Wed, 17 Feb 2021 01:55:24 -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=@redhat.com header.s=mimecast20190719 header.b=h0WXDLKY; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232010AbhBQJLi (ORCPT + 99 others); Wed, 17 Feb 2021 04:11:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53021 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbhBQJLd (ORCPT ); Wed, 17 Feb 2021 04:11:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613553007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RFusShBhS4qAoH9QAhjf7bQvV8GQfYBBL88bdpAsQow=; b=h0WXDLKYAmWqRHUPYd/t/CDP69M75DaDTPM6BmXFpyVGqiZZktdjEAJZzoBOZzdgXIhpRd Jr5Q8HYSv7mS3JnYnF/KonWjtu2Ap23utDFJb4/4unIkF2G8BF41ddqFGZ9m03sA3vKxZT LO9SLzi4CYKJWWFFbxJxVIDoekel0P4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-599-8jQz2_2HM-mUSQwRkBX7UA-1; Wed, 17 Feb 2021 04:10:03 -0500 X-MC-Unique: 8jQz2_2HM-mUSQwRkBX7UA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C3E81020C20; Wed, 17 Feb 2021 09:10:01 +0000 (UTC) Received: from [10.36.114.178] (ovpn-114-178.ams2.redhat.com [10.36.114.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF16660C62; Wed, 17 Feb 2021 09:09:58 +0000 (UTC) Subject: Re: [RFC PATCH] mm, oom: introduce vm.sacrifice_hugepage_on_oom To: Eiichi Tsukata , corbet@lwn.net, mike.kravetz@oracle.com, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, akpm@linux-foundation.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Cc: felipe.franciosi@nutanix.com References: <20210216030713.79101-1-eiichi.tsukata@nutanix.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: Date: Wed, 17 Feb 2021 10:09:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210216030713.79101-1-eiichi.tsukata@nutanix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.02.21 04:07, Eiichi Tsukata wrote: > Hugepages can be preallocated to avoid unpredictable allocation latency. > If we run into 4k page shortage, the kernel can trigger OOM even though > there were free hugepages. When OOM is triggered by user address page > fault handler, we can use oom notifier to free hugepages in user space > but if it's triggered by memory allocation for kernel, there is no way > to synchronously handle it in user space. > > This patch introduces a new sysctl vm.sacrifice_hugepage_on_oom. If > enabled, it first tries to free a hugepage if available before invoking > the oom-killer. The default value is disabled not to change the current > behavior. In addition to the other comments, some more thoughts: What if you're low on kernel memory but you end up freeing huge pages residing in ZONE_MOVABLE? IOW, this is not zone aware. -- Thanks, David / dhildenb