All of lore.kernel.org
 help / color / mirror / Atom feed
From: chrubis@suse.cz
To: Zhouping Liu <zliu@redhat.com>
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v4 1/3] mm/thp: new case thp04.c
Date: Mon, 15 Apr 2013 18:26:51 +0200	[thread overview]
Message-ID: <20130415162650.GA2405@rei> (raw)
In-Reply-To: <516C211C.1040105@redhat.com>

Hi!
> >> +		 * or not.
> >> +		 */
> >> +		sleep(10);
> >> +		count++;
> >> +
> >> +		SAFE_FILE_SCANF(cleanup, PATH_KHPD "pages_collapsed",
> >> +			       "%ld", &pages_collapsed);
> >> +		SAFE_FILE_SCANF(cleanup, PATH_KHPD "max_ptes_none",
> >> +			       "%ld", &max_ptes_none);
> >> +		SAFE_FILE_SCANF(cleanup, PATH_KHPD "pages_to_scan",
> >> +			       "%ld", &pages_to_scan);
> >> +
> >> +		if (pages_collapsed != old_pages_collapsed ||
> >> +		    max_ptes_none != old_max_ptes_none ||
> >> +		    pages_to_scan != old_pages_to_scan) {
> >> +			old_pages_collapsed = pages_collapsed;
> >> +			old_max_ptes_none = max_ptes_none;
> >> +			old_pages_to_scan = pages_to_scan;
> >> +		} else {
> >> +			changing = 0;
> >> +		}
> >> +	}
> >> +
> >> +	tst_resm(TINFO, "khugepaged daemon takes %ds to scan all thp pages",
> >> +		 count * 10);
> >> +}
> > Ah, so it acutally does polling, this is fine.
> >
> > How long scanning takes. If it is about 10 seconds, we should poll
> > faster so that the testcase has chance to finish reasonably fast.
> > (if it takes 10 seconds and we miss the first windows it will sleep
> >   doing noting for another ten seconds)
> 
> so how about 5 seconds? I will test the value on different systems.

If the scan takes 10 seconds to finish I would go for 2 seconds sleep as
that can increase the duration maximally by 20%, which is not as bad as
100% or 50%. The overhead of opening and reading a file should be really
small.

> >> +	write_file(path, "always");
> > Where this came from? Does the function check for failures? Why not to
> > use SAFE_FILE_PRINTF() as the rest of the file?
> 
> yes, there's some confused issue here.
> 
> but I have tried to use SAFE_FILE_PRINTF, but it didn't work fine for 
> transparent_hugepage/enabled,
> if # cat /sys/kernel/mm/transparent_hugepage/enabled
>        always [madvise] never
> SAFE_FILE_PRINTF only get 'always', expected 'madvise'
> if # cat /sys/kernel/mm/transparent_hugepage/enabled
> [always] madvise never
> SAFE_FILE_PRINTF get '[always]', expected 'always'
> 
> I didn't find the reason why SAFE_FILE_PRINTF couldn't get the expected 
> value?

That is strange, the only difference is that SAFE_FILE_PRINTF() uses
FILE interface while write_file() uses file descriptor directly.
Otherwise they should do exactly the same in this case. If they don't
something is broken.

Do you have a snipped of code that misbehaves this way?

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  parent reply	other threads:[~2013-04-15 16:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15  9:29 [LTP] [PATCH v4 0/3] mm/thp: add two new case Zhouping Liu
2013-04-15  9:29 ` [LTP] [PATCH v4 1/3] mm/thp: new case thp04.c Zhouping Liu
2013-04-15 12:43   ` chrubis
     [not found]     ` <516C211C.1040105@redhat.com>
2013-04-15 16:26       ` chrubis [this message]
2013-04-15  9:29 ` [LTP] [PATCH v4 2/3] lib/mem: introduce a new function set_global_mempolicy() Zhouping Liu
2013-04-15  9:29 ` [LTP] [PATCH v4 3/3] mm/thp: add new case thp05 Zhouping Liu
2013-04-15 12:48   ` chrubis
  -- strict thread matches above, loose matches on Subject: below --
2013-04-16 14:30 [LTP] [PATCH v5 0/3] mm/thp: add two new case Zhouping Liu
2013-04-16 14:30 ` [LTP] [PATCH v4 1/3] mm/thp: new case thp04.c Zhouping Liu

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=20130415162650.GA2405@rei \
    --to=chrubis@suse.cz \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=zliu@redhat.com \
    /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 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.