linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pankaj Raghav <p.raghav@samsung.com>
To: donettom@linux.ibm.com
Cc: akpm@linux-foundation.org, david@redhat.com,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-mm@kvack.org, ritesh.list@gmail.com, rppt@kernel.org,
	shuah@kernel.org, songmuchun@bytedance.com,
	tonyb@cybernetics.com, willy@infradead.org
Subject: Re: [PATCH] selftest: mm: Test if hugepage does not get leaked during __bio_release_pages()
Date: Thu,  6 Jun 2024 13:14:29 +0000	[thread overview]
Message-ID: <20240606131436.592793-1-p.raghav@samsung.com> (raw)
In-Reply-To: <20240604132801.23377-1-donettom@linux.ibm.com>


> +void run_dio_using_hugetlb(unsigned int start_off, unsigned int end_off)
> +{
> +	int fd;
> +	char *buffer =  NULL;
> +	char *orig_buffer = NULL;
> +	size_t h_pagesize = 0;
> +	size_t writesize;
> +	int free_hpage_b = 0;
> +	int free_hpage_a = 0;
> +
> +	writesize = end_off - 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");
> +
> +	/* Open the file to DIO */
> +	fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT);

I encountered a build error as follows in NixOS:

In file included from /nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/fcntl.h:342,
                 from hugetlb_dio.c:15:
In function ‘open’,
    inlined from ‘run_dio_using_hugetlb’ at hugetlb_dio.c:41:7:
/nix/store/fwh4fxd747m0py3ib3s5abamia9nrf90-glibc-2.39-52-dev/include/bits/fcntl2.h:50:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
   50 |           __open_missing_mode ();


I saw a commit that fixed similar issues with open syscall before:
8b65ef5ad486 ("selftests/mm: Fix build with _FORTIFY_SOURCE")

So something like this should fix the issue?

-       fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT);
+       fd = open("/tmp", O_TMPFILE | O_RDWR | O_DIRECT, 0664);

> +	if (fd < 0)
> +		ksft_exit_fail_msg("Error opening file");
> +



       reply	other threads:[~2024-06-06 13:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240604132801.23377-1-donettom@linux.ibm.com>
2024-06-06 13:14 ` Pankaj Raghav [this message]
     [not found] <20240523063905.3173-1-donettom@linux.ibm.com>
2024-05-23 19:13 ` Andrew Morton
2024-05-23 20:40   ` David Hildenbrand
2024-05-24  2:57     ` Andrew Morton
2024-05-24  6:21       ` David Hildenbrand
2024-05-24  6:43         ` Ritesh Harjani
2024-05-24  7:01           ` David Hildenbrand
     [not found]             ` <3c6e5e78-aa49-4002-941f-af8fd2b81d10@linux.ibm.com>
2024-05-24 15:20               ` David Hildenbrand
2024-05-24  6:53     ` Ritesh Harjani
2024-05-24 20:12       ` Andrew Morton
2024-05-24 18:13 ` Muhammad Usama Anjum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240606131436.592793-1-p.raghav@samsung.com \
    --to=p.raghav@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=donettom@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ritesh.list@gmail.com \
    --cc=rppt@kernel.org \
    --cc=shuah@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=tonyb@cybernetics.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox