public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Zhouping Liu <zliu@redhat.com>
To: gaowanlong@cn.fujitsu.com
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH 1/3] mm/ksm: set the merge_across_nodes knob before testing
Date: Fri, 10 May 2013 06:18:00 -0400 (EDT)	[thread overview]
Message-ID: <1293337679.9710631.1368181080556.JavaMail.root@redhat.com> (raw)
In-Reply-To: <518CC158.20108@cn.fujitsu.com>

Hi Wanlong,

----- Original Message -----
> From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com>
> To: "Zhouping Liu" <zliu@redhat.com>
> Cc: "LTP List" <ltp-list@lists.sourceforge.net>
> Sent: Friday, May 10, 2013 5:43:52 PM
> Subject: Re: [LTP] [PATCH 1/3] mm/ksm: set the merge_across_nodes knob before testing
> 
> On 05/10/2013 05:13 PM, Zhouping Liu wrote:
> > This kernel commit 90bd6fd31c809(ksm: allow trees per NUMA node)
> > introduced a new KSM sysfs knob /sys/kernel/mm/ksm/merge_across_nodes,
> > when it is set to zero, only pages from the same node are merged,
> > which is different with the previous behavior, and ksm test cases
> > sometimes will fail in NUMA system.
> > 
> > Signed-off-by: Zhouping Liu <zliu@redhat.com>
> 
> While how about wrap the set and reset "merge_across_nodes" value to
> functions,
> so that we can reduce the dup code and dup comments?

yeah, it sounds good, but... look at the codes again:

...
 void cleanup(void)
 {
+       if (access(PATH_KSM "merge_across_nodes", F_OK) == 0)
+               /* recover the old value */
+               SAFE_FILE_PRINTF(NULL, PATH_KSM "merge_across_nodes",
+                                "%d", merge_across_nodes);

resetting "merge_across_nodes" only needs one statement.

+
        umount_mem(CPATH, CPATH_NEW);
        TEST_CLEANUP;
 }
@@ -136,6 +143,16 @@ void setup(void)
        if (access(PATH_KSM, F_OK) == -1)
                tst_brkm(TCONF, NULL, "KSM configuration is not enabled");

+       if (access(PATH_KSM "merge_across_nodes", F_OK) == 0) {
+               /*
+                * Save the current value of merge_across_nodes knob,
+                * and make it perform as the default behavior.
+                */
+               SAFE_FILE_SCANF(NULL, PATH_KSM "merge_across_nodes",
+                               "%d", &merge_across_nodes);
+               SAFE_FILE_PRINTF(NULL, PATH_KSM "merge_across_nodes", "1");

and setting the value only needs three statements, and it looks easy to understand,
I can remove the comments from ksm02.c ksm03.c ksm04.c to reduce the duplicated comments.

also "merge_across_nodes" is a long string, I can't think of a better function name to
implement set/unset merge_across_nodes, so... IMO, the current codes is good, do you think so?

+       }
+
...
 
-- 
Thanks,
Zhouping

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2013-05-10 10:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10  9:13 [LTP] [PATCH 1/3] mm/ksm: set the merge_across_nodes knob before testing Zhouping Liu
2013-05-10  9:13 ` [LTP] [PATCH 2/3] mem: introduce clean_node() func Zhouping Liu
2013-05-10  9:13 ` [LTP] [PATCH 3/3] mem/ksm06: add a new case to test merge_across_nodes sysfs knob Zhouping Liu
2013-05-10  9:43 ` [LTP] [PATCH 1/3] mm/ksm: set the merge_across_nodes knob before testing Wanlong Gao
2013-05-10 10:18   ` Zhouping Liu [this message]
2013-05-11 11:28     ` Wanlong Gao
2013-05-13  7:57 ` Caspar Zhang
2013-05-13  8:40   ` 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=1293337679.9710631.1368181080556.JavaMail.root@redhat.com \
    --to=zliu@redhat.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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