From patchwork Mon Feb 8 10:38:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12074797 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=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham 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 7DB09C433DB for ; Mon, 8 Feb 2021 10:38:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E44C264E87 for ; Mon, 8 Feb 2021 10:38:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E44C264E87 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 676F36B006C; Mon, 8 Feb 2021 05:38:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 626596B006E; Mon, 8 Feb 2021 05:38:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5155C6B0070; Mon, 8 Feb 2021 05:38:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 3C0616B006C for ; Mon, 8 Feb 2021 05:38:17 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 00AC9181AEF1E for ; Mon, 8 Feb 2021 10:38:16 +0000 (UTC) X-FDA: 77794751034.02.uncle94_03147c5275fe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id D660210097AA1 for ; Mon, 8 Feb 2021 10:38:16 +0000 (UTC) X-HE-Tag: uncle94_03147c5275fe X-Filterd-Recvd-Size: 2398 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 8 Feb 2021 10:38:16 +0000 (UTC) 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 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: 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(-)