All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes.
@ 2017-05-03 12:42 Cyril Hrubis
  2017-05-04 18:57 ` Jan Stancek
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2017-05-03 12:42 UTC (permalink / raw)
  To: ltp

* Do not multiply free ram with 1024

  - Since we get overflow even on fairly modest
    machine with a few GB of RAM and the test
    will always report "Not enough RAM".

* Drop caches before the test

  - Otherwise the move_pages() syscalls may
    fail with ENOMEM.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
 testcases/kernel/syscalls/move_pages/move_pages12.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index eeec489..b3ebb7c 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -139,13 +139,17 @@ static void setup(void)
 
 	pgsz = (int)get_page_size();
 	SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "Hugepagesize: %d", &hpsz);
-	hpsz *= 1024;
+
+	SAFE_FILE_PRINTF("/proc/sys/vm/drop_caches", "1");
 
 	SAFE_FILE_LINES_SCANF(PATH_MEMINFO, "MemFree: %d", &memfree);
-	memfree *= 1024;
+	tst_res(TINFO, "Free RAM %d kB", memfree);
+
 	if (4 * hpsz > memfree)
 		tst_brk(TBROK, "Not enough free RAM");
 
+	hpsz *= 1024;
+
 	SAFE_FILE_SCANF(PATH_NR_HUGEPAGES, "%ld", &orig_hugepages);
 	SAFE_FILE_PRINTF(PATH_NR_HUGEPAGES, "%ld", orig_hugepages + 4);
 
-- 
2.7.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes.
  2017-05-03 12:42 [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes Cyril Hrubis
@ 2017-05-04 18:57 ` Jan Stancek
  2017-05-05 12:55   ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Stancek @ 2017-05-04 18:57 UTC (permalink / raw)
  To: ltp



----- Original Message -----
> * Do not multiply free ram with 1024
> 
>   - Since we get overflow even on fairly modest
>     machine with a few GB of RAM and the test
>     will always report "Not enough RAM".

This is obviously ok.

> 
> * Drop caches before the test
> 
>   - Otherwise the move_pages() syscalls may
>     fail with ENOMEM.
> 

How about we try to allocate/touch couple MB worth of pages
on node, we are going to move to (alloc_pages_on_node())?
If we can't allocate, exit with TCONF.

Otherwise we free those pages just before move_pages().
Wouldn't that give us better guarantee, there are some
free pages on target node?

Regards,
Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes.
  2017-05-04 18:57 ` Jan Stancek
@ 2017-05-05 12:55   ` Cyril Hrubis
  0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2017-05-05 12:55 UTC (permalink / raw)
  To: ltp

Hi!
> > * Do not multiply free ram with 1024
> > 
> >   - Since we get overflow even on fairly modest
> >     machine with a few GB of RAM and the test
> >     will always report "Not enough RAM".
> 
> This is obviously ok.

I've pushed this part.

> > 
> > * Drop caches before the test
> > 
> >   - Otherwise the move_pages() syscalls may
> >     fail with ENOMEM.
> > 
> 
> How about we try to allocate/touch couple MB worth of pages
> on node, we are going to move to (alloc_pages_on_node())?
> If we can't allocate, exit with TCONF.
> 
> Otherwise we free those pages just before move_pages().
> Wouldn't that give us better guarantee, there are some
> free pages on target node?

Sounds reasonable, I will look into this.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-05 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 12:42 [LTP] [RFC] [PATCH] syscalls/move_pages12: Two fixes Cyril Hrubis
2017-05-04 18:57 ` Jan Stancek
2017-05-05 12:55   ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.