Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3933291pxb; Mon, 1 Feb 2021 08:16:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJym141hVFx6xGUONozkmYITM9EnLws+YGzsrzRRwcO6czVu2OqhQ8smRpeVTCeA+x+Ich24 X-Received: by 2002:a50:f296:: with SMTP id f22mr6255425edm.159.1612196191098; Mon, 01 Feb 2021 08:16:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612196191; cv=none; d=google.com; s=arc-20160816; b=KJ6pb21ZFDkIwkS1BVzn6GGoAmLTSw3h+gssKDiX6NG7N4IC5MKFhGSWXdsfKKpLpr tloxHytYfcLrIohPM99VIrTvtocN15npjEx6fCqojwXQVA1fCI3lTlOfzum74M+uGckK BNTPZ7Gnlw3SB0c6HV82sQp2ZrAIfmRduT2RMew80pHxDUqNChkY6n6SHAOBdIOaCMLR /C5/e+hCggEOVdFcwnOxzP9B4iuMSfp3KWXxgTycM68XmchRgJsdhnkqKGlNri3RJjNB UxcGYFS2VABVDcUjImjdEEYFy/jSKAKrKBRHeflFbB19Vd1jIioi82gnoiY0jiLMOts8 CsYA== 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:subject :organization:from:references:cc:to:dkim-signature; bh=LTkTHTZtrG7r7H93f6RfvQ2RYuYcKcR+efM5cQJVmzE=; b=oFONpdUfc9Bng92PvABl70sQeYDE0tdAekHfPXrcOjR833WrfqHhCHdb+f1tKzbVag vK6hYp6VKYj/fAHJHhOlYArgiG0elQt5617GCh+QkGH2ONxMtNBeeQLnbsvSzKQmvNQz Hml4B0tP+XsYbK5CnzecWCOmnZhkC8nHAuaaFPHGoWFfmfxoO3MLzhTezo7sIqj2EWjD TeN0zMXzxOZHZlMlLTbwyObwiRX7ioqidfLCqD9ZtXMbJ8OpPPnDJ0o1UUNWnud9/omM N8wl8vPM41vZw7gvxF4EkCU/dPSqdsLWJqaScPWqMvpUXRnVAdXee1gzJ0s2p1rWxHjm kP1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ViWsUaMs; 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 e18si5137723eds.369.2021.02.01.08.16.05; Mon, 01 Feb 2021 08:16:31 -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=ViWsUaMs; 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 S229849AbhBAQMT (ORCPT + 99 others); Mon, 1 Feb 2021 11:12:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25407 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231152AbhBAQML (ORCPT ); Mon, 1 Feb 2021 11:12:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612195844; 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=LTkTHTZtrG7r7H93f6RfvQ2RYuYcKcR+efM5cQJVmzE=; b=ViWsUaMszsIFDcxj6WIOlEChcUzwwPwiryEctaIxoVOW0CN56KfdR/SkDTpTGsKFLs98Ea MK/dXII9bP5PiToMjUzmmk0hP15rCLgsYA31L6weLsup4vYS+r23Y/KGT87AEmRx/jax/F uQ4+PED0y6xyw+DEgviZdHQQqoZOtKU= 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-355-Nv06uFrmOrOjzL9zhKXSug-1; Mon, 01 Feb 2021 11:10:39 -0500 X-MC-Unique: Nv06uFrmOrOjzL9zhKXSug-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 75E0E107ACE8; Mon, 1 Feb 2021 16:10:35 +0000 (UTC) Received: from [10.36.115.24] (ovpn-115-24.ams2.redhat.com [10.36.115.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id C679B60C66; Mon, 1 Feb 2021 16:10:28 +0000 (UTC) To: Mike Kravetz , Muchun Song , Oscar Salvador Cc: Jonathan Corbet , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Michal Hocko , "Song Bao Hua (Barry Song)" , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel References: <20210117151053.24600-1-songmuchun@bytedance.com> <20210117151053.24600-6-songmuchun@bytedance.com> <20210126092942.GA10602@linux> <6fe52a7e-ebd8-f5ce-1fcd-5ed6896d3797@redhat.com> <20210126145819.GB16870@linux> <259b9669-0515-01a2-d714-617011f87194@redhat.com> <20210126153448.GA17455@linux> <9475b139-1b33-76c7-ef5c-d43d2ea1dba5@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Subject: Re: [External] Re: [PATCH v13 05/12] mm: hugetlb: allocate the vmemmap pages associated with each HugeTLB page Message-ID: <41160c2e-817d-3ef2-0475-4db58827c1c3@redhat.com> Date: Mon, 1 Feb 2021 17:10:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> What's your opinion about this? Should we take this approach? > > I think trying to solve all the issues that could happen as the result of > not being able to dissolve a hugetlb page has made this extremely complex. > I know this is something we need to address/solve. We do not want to add > more unexpected behavior in corner cases. However, I can not help but think > about similar issues today. For example, if a huge page is in use in > ZONE_MOVABLE or CMA there is no guarantee that it can be migrated today. Yes, hugetlbfs is broken with alloc_contig_range() as e.g., used by CMA and needs fixing. Then, similar problems as with hugetlbfs pages on ZONE_MOVABLE apply. hugetlbfs pages on ZONE_MOVABLE for memory unplug are problematic in corner cases only I think: 1. Not sufficient memory to allocate a destination page. Well, nothing we can really do about that - just like trying to migrate any other memory but running into -ENOMEM. 2. Trying to dissolve a free huge page but running into reservation limits. I think we should at least try allocating a new free huge page before failing. To be tackled in the future. > Correct? We may need to allocate another huge page for the target of the > migration, and there is no guarantee we can do that. > I agree that 1. is similar to "cannot migrate because OOM". So thinking about it again, we don't actually seem to lose that much when a) Rejecting migration of a huge page when not being able to allocate the vmemmap for our source page. Our system seems to be under quite some memory pressure already. Migration could just fail because we fail to allocate a migration target already. b) Rejecting to dissolve a huge page when not able to allocate the vmemmap. Dissolving can fail already. And, again, our system seems to be under quite some memory pressure already. c) Rejecting freeing huge pages when not able to allocate the vmemmap. I guess the "only" surprise is that the user might now no longer get what he asked for. This seems to be the "real change". So maybe little actually speaks against allowing for migration of such huge pages and optimizing any huge page, besides rejecting freeing of huge pages and surprising the user/admin. I guess while our system is under memory pressure CMA and ZONE_MOVABLE are already no longer able to always keep their guarantees - until there is no more memory pressure. -- Thanks, David / dhildenb