Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp439769pxf; Wed, 10 Mar 2021 09:09:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdEo4vSQL96ipuB2yhvkiKMND4I8XAibajGRrqZJRU9ZNjoDxUlJnPoBFs8koEI61dQyg8 X-Received: by 2002:a17:907:ea3:: with SMTP id ho35mr4716795ejc.219.1615396197212; Wed, 10 Mar 2021 09:09:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615396197; cv=none; d=google.com; s=arc-20160816; b=UJsRDOxOuLXzzgpngSpPh/4gW8UfTxH1sDb7zI+93ByMhlnVStQKTGwzXSQTRS3dEF FwL2OylFD5TxNjuZJL2szwvACiozimWbNwRksEXTlTlvJYokQZZ3XhRfIhCChUf6h8y5 oXIulObDVkJ/M72H9aI1UnQB9gjfELoH9SBH5AYjKni11xXIALwR2PUOdUhvUh5KU007 adOPvzd3VI9S2xsqLnhNLbH2IU6ZzYbGVOv0FtbSCq9LWTgL3XzZgdmGLuShDDZGjA8K RxS4mfn6b72SzSLWn9Qapo0OMThsUZPdEbEl6bMwKPOBKmusOtBE+HwKMGBm/qDVexGF AdgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oxRVGJsvmt7dqxKyl+MpB2xrjmX1Sge7XlOHbCjXxss=; b=x5kSh/H3DHRIcZoAa5PVTf06qjQK20vsq9IUH4g7iULwGfcrd1ogFIJIHzYSX3jykJ yCfYB40g4k71VwCb8VRPZ+7TIca/k57GJoVkox30b707mufVsJdwlbRtbteDVGf3cyBD 4rWSToXbNaBQTIhO/wnQxfQPFMaJRQ55wPtWIDj6R9JpDRHEgWhrix0aHumKlMTlmNmZ uMFKBWUuV4vRarOna0tKkCuqWJkbcDKWSd4VDFYT7GKjYToqAqF0iRo/rMm85uUD9ViE NmgBoAkGJODgsSm3r0ZVQtLF6cb0H8whlr4BLegnT3WEliXCH87swOAYrpUYfe7doBvH 9gLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=DIDGktoo; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm10si1481739ejc.418.2021.03.10.09.09.25; Wed, 10 Mar 2021 09:09:57 -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=@suse.com header.s=susede1 header.b=DIDGktoo; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231263AbhCJRFc (ORCPT + 99 others); Wed, 10 Mar 2021 12:05:32 -0500 Received: from mx2.suse.de ([195.135.220.15]:57834 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233026AbhCJRFJ (ORCPT ); Wed, 10 Mar 2021 12:05:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1615395907; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oxRVGJsvmt7dqxKyl+MpB2xrjmX1Sge7XlOHbCjXxss=; b=DIDGktoo8TcsZBKYJO7KqeoyDFfd369JaxJlZfuiymiwaxTZXqkzKWjIKSWHliSvFsLsaj LeeAD2GlrgtQGoDzptqHyNXLfyJXZ96yxc9L3wQ0m4jluIZT1dCDj5F+fh85MLVJK/aW3b oov0qS2Lqd8EaOS5XptvEoDIRIF+mPw= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C4B7CABD7; Wed, 10 Mar 2021 17:05:07 +0000 (UTC) Date: Wed, 10 Mar 2021 18:05:07 +0100 From: Michal Hocko To: Zi Yan Cc: Mike Kravetz , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Oscar Salvador , David Rientjes , Andrew Morton Subject: Re: [RFC PATCH 0/3] hugetlb: add demote/split page functionality Message-ID: References: <20210309001855.142453-1-mike.kravetz@oracle.com> <298CE371-115E-4A78-A732-57D7B37DF74C@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <298CE371-115E-4A78-A732-57D7B37DF74C@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 10-03-21 11:46:57, Zi Yan wrote: > On 10 Mar 2021, at 11:23, Michal Hocko wrote: > > > On Mon 08-03-21 16:18:52, Mike Kravetz wrote: > > [...] > >> Converting larger to smaller hugetlb pages can be accomplished today by > >> first freeing the larger page to the buddy allocator and then allocating > >> the smaller pages. However, there are two issues with this approach: > >> 1) This process can take quite some time, especially if allocation of > >> the smaller pages is not immediate and requires migration/compaction. > >> 2) There is no guarantee that the total size of smaller pages allocated > >> will match the size of the larger page which was freed. This is > >> because the area freed by the larger page could quickly be > >> fragmented. > > > > I will likely not surprise to show some level of reservation. While your > > concerns about reconfiguration by existing interfaces are quite real is > > this really a problem in practice? How often do you need such a > > reconfiguration? > > > > Is this all really worth the additional code to something as tricky as > > hugetlb code base? > > > >> include/linux/hugetlb.h | 8 ++ > >> mm/hugetlb.c | 199 +++++++++++++++++++++++++++++++++++++++- > >> 2 files changed, 204 insertions(+), 3 deletions(-) > >> > >> -- > >> 2.29.2 > >> > > The high level goal of this patchset seems to enable flexible huge page > allocation from a single pool, when multiple huge page sizes are available > to use. The limitation of existing mechanism is that user has to specify > how many huge pages he/she wants and how many gigantic pages he/she wants > before the actual use. I believe I have understood this part. And I am not questioning that. This seems useful. I am mostly asking whether we need such a flexibility. Mostly because of the additional code and future maintenance complexity which has turned to be a problem for a long time. Each new feature tends to just add on top of the existing complexity. > I just want to throw an idea here, please ignore if it is too crazy. > Could we have a variant buddy allocator for huge page allocations, > which only has available huge page orders in the free list? For example, > if user wants 2MB and 1GB pages, the allocator will only have order-9 and > order-19 pages; when order-9 pages run out, we can split order-19 pages; > if possible, adjacent order-9 pages can be merged back to order-19 pages. I assume you mean to remove those pages from the allocator when they are reserved rather than really used, right? I am not really sure how you want to deal with lower orders consuming/splitting too much from higher orders which then makes those unusable for the use even though they were preallocated for a specific workload. Another worry is that a gap between 2MB and 1GB pages is just too big so a single 2MB request from 1G pool will make the whole 1GB page unusable even when the smaller pool needs few pages. -- Michal Hocko SUSE Labs