Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3893939pxb; Mon, 8 Feb 2021 02:52:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJy60DYXKwooRglLBuklVjxRoMwKTl7zytaKANENlUQtQk8WBvYKljuJ/DwGOmAv/qXicpSA X-Received: by 2002:a17:906:1712:: with SMTP id c18mr16594549eje.417.1612781526037; Mon, 08 Feb 2021 02:52:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612781526; cv=none; d=google.com; s=arc-20160816; b=IB8JWAAx67UmDzsTI84Xo2UCo5rV/WblNArMEizQwAH33BYjpL9NkTIiP0M/xEBENo pmBdkbq+IdlkHNfcRHe7c4vo/VK8KrloBXiA7JMtYMRZa5nmzZvEyBO9+pQoN3yLMuG2 U5ClJqK/VT6vE53ZYzfF9bpS/b9CMeepfS1I+AWery2iuqWiPuSqdXpYsQOMR27QoEef zjQMk4hM8mKarv6sk/g93I/kgl1aeDa6o+9sX45mO/c4B9407V8N75nwm5AKC+KHdZek DGL+owmDAksq6kWf7xVUaPpoidF7CLdEEvolPUhMVE91msM/L2AYJyQi6xemHJedeCfM TmLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=NItfBXlq21ly+w+sHGvN+o6Zv1n9stRgOXr/+i5Q/W0=; b=pSmyNREv6ngkf8rHOIVERwRsTSMWAuzK9UlN3g0wdRSYjKzMP+xaGxMm1ZnlgfdWe8 oXqOyjwsWQMC1xIXzewgWpmCvcKSoEDc2R5kGG80nUD4IYaXg1WC+wQGT9Tm3Cj5WRMP V/95qYScwlbQlS7cQephWzQrRjBxOJd9d0dnK37Od87PvBYUGgo2H8jfjQ64Tj3tXTV6 fvDRvv9cmfUDtPkDWtPm55iX9hUpu1rTUKA4E7x8n/X9C8kWF6VXn1kHYs0zOBkjMuW8 C3c4jzQpLNb62fJmPbMYpQdsxjfcfGsTUcIrsLA9qOSM2YHCjhUBAHQR2Rel1SwtTo2H LzAw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si12176239ejd.83.2021.02.08.02.51.41; Mon, 08 Feb 2021 02:52:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbhBHKsZ (ORCPT + 99 others); Mon, 8 Feb 2021 05:48:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:57490 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231860AbhBHKi4 (ORCPT ); Mon, 8 Feb 2021 05:38:56 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 254E3AE74; Mon, 8 Feb 2021 10:38:15 +0000 (UTC) From: Oscar Salvador To: Mike Kravetz Cc: David Hildenbrand , Muchun Song , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [RFC PATCH 0/2] Make alloc_contig_range handle Hugetlb pages Date: Mon, 8 Feb 2021 11:38:10 +0100 Message-Id: <20210208103812.32056-1-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I promised to Mike to have a look into this a few weeks ago. This is my first attempt. I carried out some tests with a module that tries to allocate with alloc_contig_range() from a range where we have free and in-use hugetlb pages. So far I did not spot any problem and it worked. Please, note that it is not fully completed, as some things remain to be sorted out (see list below), but I wanted to publish it to see whether the way I am going makes sense to people, or I am doing something worrisome. E.g: - What happens when we allocated a new hugetlb page, but we cannot dissolve the old one? (should not really happen (tm)) - When allocating the new hugetlb page I try to do it in the same node the old one is. Should we be more flexible and allow to fallback to other nodes? Userspace can request hugetlb on specific nodes [1], but it can also request them through generic interfaces [2]. - Problems I did not foresee yet [1] /sys/devices/system/node/nodeX/hugepages/* [2] /proc/sys/vm/nr_hugepages or /sys/kernel/mm/hugepages/* Oscar Salvador (2): mm,page_alloc: Make alloc_contig_range handle in-use hugetlb pages mm,page_alloc: Make alloc_contig_range handle free hugetlb pages include/linux/hugetlb.h | 6 ++++++ mm/compaction.c | 28 ++++++++++++++++++++++++++++ mm/hugetlb.c | 35 +++++++++++++++++++++++++++++++++++ mm/vmscan.c | 5 +++-- 4 files changed, 72 insertions(+), 2 deletions(-) -- 2.16.3