mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: akpm@linux-foundation.org, hughd@google.com, willy@infradead.org,
	david@redhat.com, 21cnbao@gmail.com, ryan.roberts@arm.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] selftests: mincore: fix tmpfs mincore test failure
Date: Thu, 27 Mar 2025 10:36:42 -0400	[thread overview]
Message-ID: <992DD536-7047-4C2C-97EB-7F23100143E3@nvidia.com> (raw)
In-Reply-To: <99a3e190d38b08a2b96ede952a29893bffdb3432.1742960003.git.baolin.wang@linux.alibaba.com>

On 25 Mar 2025, at 23:38, Baolin Wang wrote:

> When running mincore test cases, I encountered the following failures:
>
> "
> mincore_selftest.c:359:check_tmpfs_mmap:Expected ra_pages (511) == 0 (0)
> mincore_selftest.c:360:check_tmpfs_mmap:Read-ahead pages found in memory
> check_tmpfs_mmap: Test terminated by assertion
>           FAIL  global.check_tmpfs_mmap
> not ok 5 global.check_tmpfs_mmap
> FAILED: 4 / 5 tests passed
> "
>
> The reason for the test case failure is that my system automatically enabled
> tmpfs large folio allocation by adding the 'transparent_hugepage_tmpfs=always'
> cmdline. However, the test case still expects the tmpfs mounted on /dev/shm to
> allocate small folios, which leads to assertion failures when verifying readahead
> pages.
>
> To fix this issue, remount tmpfs to a new test directory and set the 'huge=never'
> parameter to avoid allocating large folios, which can pass the test.
>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
>  .../selftests/mincore/mincore_selftest.c      | 25 +++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)
>

<snip>

>
>  	errno = 0;
> -	fd = open("/dev/shm", O_TMPFILE | O_RDWR, 0600);
> +	/* Do not use large folios for tmpfs mincore testing */
> +	retval = mount("tmpfs", tmpfs_loc, "tmpfs", 0, "huge=never,size=4M");
> +	ASSERT_EQ(0, retval) {
> +		TH_LOG("Unable to mount tmpfs for testing\n");
> +	}
> +
> +	retval = snprintf(testfile, INPUT_MAX, "%s/test_file", tmpfs_loc);
> +	ASSERT_GE(INPUT_MAX, retval) {
> +		TH_LOG("Unable to create a tmpfs for testing\n");
> +	}
> +
> +	fd = open(testfile, O_CREAT|O_RDWR, 0664);

The fd permission is changed from 0600 to 0664, but it probably does not
matter.

>  	ASSERT_NE(-1, fd) {
>  		TH_LOG("Can't create temporary file: %s",
>  			strerror(errno));
> @@ -363,6 +382,8 @@ TEST(check_tmpfs_mmap)
>  	munmap(addr, FILE_SIZE);
>  	close(fd);
>  	free(vec);
> +	umount(tmpfs_loc);
> +	rmdir(tmpfs_loc);
>  }
>
>  TEST_HARNESS_MAIN
> -- 
> 2.43.5

Otherwise, LGTM. Reviewed-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi

  reply	other threads:[~2025-03-27 14:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26  3:38 [PATCH 0/2] Fix mincore() tmpfs " Baolin Wang
2025-03-26  3:38 ` [PATCH 1/2] selftests: mincore: fix tmpfs mincore " Baolin Wang
2025-03-27 14:36   ` Zi Yan [this message]
2025-03-30 19:47     ` Baolin Wang
2025-04-01 12:54   ` David Hildenbrand
2025-04-07  3:49     ` Baolin Wang
2025-04-07  7:49       ` David Hildenbrand
2025-04-07  8:35         ` Baolin Wang
2025-03-26  3:38 ` [PATCH 2/2] mm: mincore: use folio_pte_batch() to batch process large folios Baolin Wang
2025-03-27 10:49   ` Oscar Salvador
2025-03-27 11:54     ` Baolin Wang
2025-03-27 14:08   ` Ryan Roberts
2025-03-28 13:10     ` Oscar Salvador
2025-03-30 19:57     ` Baolin Wang
2025-04-01 10:45       ` Ryan Roberts
2025-04-01 13:04         ` David Hildenbrand
2025-04-07  6:33           ` Baolin Wang
2025-04-14 13:46             ` Ryan Roberts
2025-05-07  5:12   ` Dev Jain
2025-05-07  9:48     ` Baolin Wang
2025-05-07  9:54       ` David Hildenbrand
2025-05-07 10:03         ` Baolin Wang
2025-05-07 11:14           ` Ryan Roberts

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=992DD536-7047-4C2C-97EB-7F23100143E3@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.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

all inboxes | Powered by JetHome®