public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] madvise06: wait a bit after madvise() call
Date: Fri, 22 Jul 2016 02:59:26 -0400 (EDT)	[thread overview]
Message-ID: <36557227.7231767.1469170766347.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160722034603.GA15996@gmail.com>



----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: "Chunyu Hu" <chuhu@redhat.com>, ltp@lists.linux.it
> Sent: Friday, 22 July, 2016 5:46:03 AM
> Subject: Re: [LTP] [PATCH] madvise06: wait a bit after madvise() call
> 
> On Thu, Jul 21, 2016 at 04:23:27PM +0200, Jan Stancek wrote:
> > 
> > I'm starting to run out of ideas how we can test this somewhat reliably.
> > 
> > Attached is approach v3, which sets up memory cgroup:
> > - memory.limit_in_bytes is 128M
> > - we allocate 512M
> > - as consequence ~384M should be swapped while system should still have
> >   plenty of free memory, which should be available for cache
> 
> Drop caches before testing is really good, we think the same!
> 
> And setting cgroup shorten the test time if there could guarantee
> cgroup OOM is off and swappiness is a little larger, that would
> be more reliable I think.

Agreed, we can do that.

> 
> One question is that you wrote function count_swapped_pages() but
> didn't using it, seems forgot to put somewhere?

I left it in, just in case I would use it in v4.

> 
> Anyway, V3 is strong enough expecially it combines the two method
> together.

> save this function by oneline:
> 
>  /* drop caches*/
>  SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "1");

Good point.

> 
> > 
> > 	sysinfo(&sys_buf_start);
> > 	if (sys_buf_start.freeram < 2 * CHUNK_SZ)
> > 		tst_brk(TCONF, "System RAM is too small, skip test");
> > 	if (sys_buf_start.freeswap < 2 * CHUNK_SZ)
> > 		tst_brk(TCONF, "System swap is too small");
> > 
> > 	SAFE_MKDIR("memory", 0700);
> > 	SAFE_MOUNT("memory", "memory", "cgroup", 0, "memory");

I'm thinking if I should turn this into normal mount and TCONF if
there is no memory cgroup support in kernel.

> > 	if (access("memory/memory.limit_in_bytes", R_OK | W_OK))
> > 		tst_brk(TCONF, "cgroup memory.limit_in_bytes needed");
> > 
> > 	SAFE_MKDIR("memory/madvise06", 0700);
> > 	SAFE_FILE_PRINTF("memory/madvise06/memory.limit_in_bytes", "%ld\n",
> > 		PASS_THRESHOLD);
> 
> Turn off oom, enlarge swappiness
> 
>  SAFE_FILE_PRINTF("memory/madvise06/memory.oom_control", "0");
>  SAFE_FILE_PRINTF("memory/madvise06/memory.swappiness", "60");

I'll add that.

> 
> > 	SAFE_FILE_PRINTF("memory/madvise06/tasks", "%d\n", getpid());
> > }
> > 
> > static void cleanup(void)
> > {
> > 	FILE *f = fopen("memory/tasks", "w");
> > 
> > 	if (f) {
> > 		fprintf(f, "%d\n", getpid());
> > 		fclose(f);
> > 	}
> > 	rmdir("memory/madvise06");
> > 	umount("memory");
> > }
> > 
> > static long count_swapped_pages(void *ptr, long pg_count)
> 
> A compile Warnning:
> 
> madvise06.c:94:13: warning: ‘count_swapped_pages’ defined but not used
> [-Wunused-function]
> static long count_swapped_pages(void *ptr, long pg_count)

I'll drop it in a patch.

Regards,
Jan

> 
> 
> Regards,
> Li Wang
> 

  reply	other threads:[~2016-07-22  6:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 13:37 [LTP] [PATCH] madvise06: wait a bit after madvise() call Jan Stancek
2016-07-18 14:03 ` Cyril Hrubis
2016-07-18 14:22   ` Jan Stancek
2016-07-18 14:49     ` Cyril Hrubis
2016-07-19  5:58 ` Li Wang
2016-07-19  6:56   ` Jan Stancek
2016-07-19  8:57     ` Li Wang
2016-07-20 14:37       ` Jan Stancek
2016-07-21  5:33         ` Li Wang
2016-07-21 10:31         ` Chunyu Hu
2016-07-21 11:02           ` Li Wang
2016-07-21 14:23             ` Jan Stancek
2016-07-22  3:46               ` Li Wang
2016-07-22  6:59                 ` Jan Stancek [this message]
2016-07-22 10:49               ` Chunyu Hu
2016-07-22 10:54                 ` Chunyu Hu
2016-07-22 11:02                   ` Jan Stancek

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=36557227.7231767.1469170766347.JavaMail.zimbra@redhat.com \
    --to=jstancek@redhat.com \
    --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