public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC] Limit the tmpfs size on mounting
Date: Wed, 30 Jun 2021 11:20:56 +0200	[thread overview]
Message-ID: <YNw3ePbVhio3s9JX@yuki> (raw)
In-Reply-To: <CAEemH2da0dOeKpnZZ6+A696gFL+nDAiP7UL9tqm68JH8KO-Qkw@mail.gmail.com>

Hi!
> LTP mount and make use of the whole tmpfs of the test system,
> generally, it's fine. But if a test (e.g fallocate06) try to fill full in
> the
> filesystem, it takes too long to complete testing on a large memory
> system.
> 
> I'm thinking whether we should limit the mount tmpfs size for the
> LTP test, maybe only give 512MB?  but the tricky part for me is to
> add options like "-o size=512M" to prepare_device(), or do some
> additional work for tmpfs mounting.
> 
> and any else way can speed up is also welcome. I'd like to hear
> more advice. Thanks!

I guess that appending '-o size ...' to the mount flags in prepare_device()
is reasonable, but instead of hardcoing the value we should do the same
as we do with the loop devices and the size should be
MAX(tst_test->dev_min_size, DEV_SIZE_MB).

For tmpfs we will do something as:

	...
	const char *mnt_data = tst_test->mnt_data;

	if (!strcmp(dev.fs_type, "tmpfs")) {
		unsigned int dev_size = MAX(tst_test->dev_min_size, DEV_SIZE_MB);

		if (tst_test->mnt_data) {
			snprintf(buf, sizeof(buf), "%s,-o size %uMB",
				 tst_test->mnt_data, dev_size);
		} else {
			snprintf(buf, sizeof(buf), "-o size=%uMB", dev_size);
		}

		tst_res(TINFO, "Limiting tmpfs size to %uMB", dev_size);

		mnt_data = buf;
	}

> # df -Th | grep tmpfs
> Filesystem                             Type      Size  Used Avail Use%
> Mounted on
> devtmpfs                               devtmpfs  126G     0  126G   0% /dev
> tmpfs                                  tmpfs     126G  4.0K  126G   1%
> /dev/shm
> tmpfs                                  tmpfs     126G   18M  126G   1% /run
> tmpfs                                  tmpfs     126G     0  126G   0%
> /sys/fs/cgroup
> /dev/loop0                             tmpfs     126G   23G  104G  18%

Also it looks like should pass something as "ltp-tmpfs" instead of the
"/dev/loopX" string in a case of "tmpfs" filesystem in order not to
confuse people...

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2021-06-30  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-30  8:08 [LTP] [RFC] Limit the tmpfs size on mounting Li Wang
2021-06-30  9:20 ` Cyril Hrubis [this message]
2021-07-01  5:58   ` Li Wang

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=YNw3ePbVhio3s9JX@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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