From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C640C433E0 for ; Wed, 17 Feb 2021 09:10:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D345964DF0 for ; Wed, 17 Feb 2021 09:10:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D345964DF0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5B29A8D002B; Wed, 17 Feb 2021 04:10:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 564278D0019; Wed, 17 Feb 2021 04:10:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 452C48D002B; Wed, 17 Feb 2021 04:10:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 2D9108D0019 for ; Wed, 17 Feb 2021 04:10:07 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E4F436D9B for ; Wed, 17 Feb 2021 09:10:06 +0000 (UTC) X-FDA: 77827188012.10.card33_23155622764b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id C645E1698E3 for ; Wed, 17 Feb 2021 09:10:06 +0000 (UTC) X-HE-Tag: card33_23155622764b X-Filterd-Recvd-Size: 3429 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Feb 2021 09:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613553005; 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=QPdvjnnP1R+9gDV+zmUc4lsAfj3h4fAdrT00RlaRS239TPavBbmoHfvl0eSd8kSaWWkVqS kFnkyIURfm7E+iCTCynmhm2oniGo+xt8Sw+7SaTZgsoZKxcAVNm4zj312tN5mifd5jyFhS SVKa7RioOiS9Ht0JqBy59sjImoK4WHc= 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 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 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