linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Zach O'Keefe" <zokeefe@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, "Zach O'Keefe" <zokeefe@google.com>
Subject: [PATCH mm-unstable] selftests/vm: fix "add thp collapse file and tmpfs testing" for tmpfs
Date: Tue, 13 Sep 2022 14:25:17 -0700	[thread overview]
Message-ID: <20220913212517.3163701-1-zokeefe@google.com> (raw)

In write_settings() and save_settings() we properly only read/write
/sys/block/<device>/queue/read_ahead_kb if the test file is not backed
by tmpfs.  However, in get_finfo(), we unconditionally attempt to
resolve the major/minor device pair and search for device interface,
which we fail to do when the device is the null device (major 0), as is
the case when stat(2)'ing a tmpfs-backed file.

Only resolve path to queue/read_ahead_kb when dealing with non-tmpfs
files.

Fixes: 64b9fb1fa904 ("selftests/vm: add thp collapse file and tmpfs testing")
Signed-off-by: Zach O'Keefe <zokeefe@google.com>
---
 tools/testing/selftests/vm/khugepaged.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/vm/khugepaged.c b/tools/testing/selftests/vm/khugepaged.c
index 702f64b3aa08..ad46fdb57d78 100644
--- a/tools/testing/selftests/vm/khugepaged.c
+++ b/tools/testing/selftests/vm/khugepaged.c
@@ -453,6 +453,8 @@ static void get_finfo(const char *dir)
 		exit(EXIT_FAILURE);
 	}
 	finfo.type = fs.f_type == TMPFS_MAGIC ? VMA_SHMEM : VMA_FILE;
+	if (finfo.type == VMA_SHMEM)
+		return;
 
 	/* Find owning device's queue/read_ahead_kb control */
 	if (snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/uevent",
-- 
2.37.2.789.g6183377224-goog



                 reply	other threads:[~2022-09-13 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220913212517.3163701-1-zokeefe@google.com \
    --to=zokeefe@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.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