From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF787347534; Tue, 28 Apr 2026 20:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777409201; cv=none; b=Aa3hIziGB24OJvPh3DLqB5ZtkD6lZAf9qizthN7DufD4QyhhpHDH1/pr8EGxG73Ob4exg0YtNbhy1WK7oXgXKubcrfle8SSW9kUaWgHb46Cm1ag6v/RLrU0d9/LdkyPxQeUyZHGCoR1It3q+XPT7b0hAatSwD24RCBfVqrIOFoM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777409201; c=relaxed/simple; bh=dW6FhGF6pU1ym+r/rDESusHBHIrjPAzWgWJPywW+wGk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZPlw017SvB/GB1Abl8VJo2JKvoSuJXLPOama/lgsiO5LzhbJF8zMT38W9G/nJG8YlAcAZzlkwv65TrsNKCuYdd/DZYwzeWAcx7rsfl8TrrvGc0chIg7bMKuNL8ZqJGpbI2UjdMWj4ljRdOQOZzY6Fglbs/iyt5c4slEhmTm9Nlc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fYuSQhSV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fYuSQhSV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6DBEC2BCAF; Tue, 28 Apr 2026 20:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777409201; bh=dW6FhGF6pU1ym+r/rDESusHBHIrjPAzWgWJPywW+wGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fYuSQhSVJ0ne2pgs7DvNzBdLL+G7mpiR2pp5C86jf+5176Cqh40SJcetAD5R9OMMn UROUjRqwcCbItrnjUJ9UCitoH+/D8VGH5E1o0CEXfEBBUwjChlwUxNpS064vULczf0 NwjkOyYaU5HHVj93kINvzKGKm3Y/nxQvdczmtMMXPWURgH14HTphEAGHIyqb5ij3GD AK1E0tRd7AGjK4iuxNPZsAy1jPYwds9CRgB89P4KIGtx5+YKGOi4y+y/7eC88Y9vhz ugAjg/AoCer2QAdSJloOlHPCzVkhAGf9OxkOc9azhyQBlX1jCpwI2RwBvcEDFl+bXJ c17JRcaUxrrEA== From: Mike Rapoport To: Andrew Morton , David Hildenbrand Cc: Baolin Wang , Barry Song , Dev Jain , Donet Tom , Jason Gunthorpe , John Hubbard , "Liam R. Howlett" , Lance Yang , Leon Romanovsky , Lorenzo Stoakes , Luiz Capitulino , Mark Brown , Michal Hocko , Mike Rapoport , Nico Pache , Peter Xu , Ryan Roberts , Sarthak Sharma , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , Zi Yan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v3 35/54] selftests/mm: hugepage_dio: add setup of HugeTLB pages Date: Tue, 28 Apr 2026 23:42:21 +0300 Message-ID: <20260428204240.1924129-36-rppt@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260428204240.1924129-1-rppt@kernel.org> References: <20260428204240.1924129-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Mike Rapoport (Microsoft)" hugepage_dio test fails if there are no free huge pages prepared by a wrapper script. Add setup of HugeTLB pages to the test and make sure that the original settings are restored on the test exit. Signed-off-by: Mike Rapoport (Microsoft) --- tools/testing/selftests/mm/hugetlb_dio.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/testing/selftests/mm/hugetlb_dio.c b/tools/testing/selftests/mm/hugetlb_dio.c index 47019433ddaf..fb4600570e13 100644 --- a/tools/testing/selftests/mm/hugetlb_dio.c +++ b/tools/testing/selftests/mm/hugetlb_dio.c @@ -85,8 +85,6 @@ static void run_dio_using_hugetlb(int fd, unsigned int start_off, /* Get the default huge page size */ h_pagesize = default_huge_page_size(); - if (!h_pagesize) - ksft_exit_fail_msg("Unable to determine huge page size\n"); /* Reset file position since fd is shared across tests */ if (lseek(fd, 0, SEEK_SET) < 0) @@ -94,10 +92,6 @@ static void run_dio_using_hugetlb(int fd, unsigned int start_off, /* Get the free huge pages before allocation */ free_hpage_b = hugetlb_free_default_pages(); - if (free_hpage_b == 0) { - close(fd); - ksft_exit_skip("No free hugepage, exiting!\n"); - } /* Allocate a hugetlb page */ orig_buffer = mmap(NULL, h_pagesize, mmap_prot, mmap_flags, -1, 0); @@ -141,8 +135,8 @@ int main(void) ksft_print_header(); - /* Check if huge pages are free */ - if (!hugetlb_free_default_pages()) + /* request a huge page */ + if (!hugetlb_setup_default(1)) ksft_exit_skip("No free hugepage, exiting\n"); fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT, 0664); -- 2.53.0