linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pintu Kumar <pintu.ping@gmail.com>
To: open list <linux-kernel@vger.kernel.org>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org
Subject: KSM not working in 4.9 Kernel
Date: Fri, 14 Sep 2018 19:58:01 +0530	[thread overview]
Message-ID: <CAOuPNLj1wx4sznrtLdKjcvuTf0dECPWzPaR946FoYRXB6YAGCw@mail.gmail.com> (raw)

Hi All,

Board: Hikey620 ARM64
Kernel: 4.9.20

I am trying to verify KSM (Kernel Same Page Merging) functionality on
4.9 Kernel using "mmap" and madvise user space test utility.
But to my observation, it seems KSM is not working for me.
CONFIG_KSM=y is enabled in kernel.
ksm_init is also called during boot up.
  443 ?        SN     0:00 [ksmd]

ksmd thread is also running.

However, when I see the sysfs, no values are written.
~ # grep -H '' /sys/kernel/mm/ksm/*
/sys/kernel/mm/ksm/pages_hashed:0
/sys/kernel/mm/ksm/pages_scanned:0
/sys/kernel/mm/ksm/pages_shared:0
/sys/kernel/mm/ksm/pages_sharing:0
/sys/kernel/mm/ksm/pages_to_scan:200
/sys/kernel/mm/ksm/pages_unshared:0
/sys/kernel/mm/ksm/pages_volatile:0
/sys/kernel/mm/ksm/run:1
/sys/kernel/mm/ksm/sleep_millisecs:1000

So, please let me know if I am doing any thing wrong.

This is the test utility:
int main(int argc, char *argv[])
{
        int i, n, size;
        char *buffer;
        void *addr;

        n = 100;
        size = 100 * getpagesize();
        for (i = 0; i < n; i++) {
                buffer = (char *)malloc(size);
                memset(buffer, 0xff, size);
                addr =  mmap(NULL, size,
                           PROT_READ | PROT_EXEC | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS,
                           -1, 0);
                madvise(addr, size, MADV_MERGEABLE);
                sleep(1);
        }
        printf("Done....press ^C\n");

        pause();

        return 0;
}



Thanks,
Pintu

             reply	other threads:[~2018-09-14 14:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 14:28 Pintu Kumar [this message]
2018-09-14 17:12 ` Yang Shi
2018-09-15  2:55   ` Pintu Kumar
2018-09-16 15:32 ` Mike Rapoport
2018-09-16 17:05   ` Pintu Kumar
2018-09-17  4:37     ` Mike Rapoport
2018-09-17  6:16       ` Pintu Kumar
2018-09-17 11:55         ` Pintu Kumar
2018-09-17 14:59           ` Mike Rapoport
2018-09-20 11:51             ` Pintu Kumar
2018-09-21  8:16               ` Mike Rapoport

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=CAOuPNLj1wx4sznrtLdKjcvuTf0dECPWzPaR946FoYRXB6YAGCw@mail.gmail.com \
    --to=pintu.ping@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@armlinux.org.uk \
    /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