Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3114219imm; Sun, 16 Sep 2018 10:05:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY0b7gsPSdFbRbx0YhFqvhn8VJ1X6KkuK4Pl/78agYuaUS/scHIp5OBAO8BgXknpGFcP6jA X-Received: by 2002:a62:4fd9:: with SMTP id f86-v6mr22528308pfj.110.1537117550957; Sun, 16 Sep 2018 10:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537117550; cv=none; d=google.com; s=arc-20160816; b=grxIbf+qDAk21LC7PQuAyvAOX7XfRovSqQfONww9z23XUuo3LPO/eNjP6Lsp9+5x+G 5PZbOsA1kTlhsbVMmKTlFKasJPOqROlsJKvSqMdc43+LFb+Gy3+4ZewyooGwVL9zJb1H PKEoqZJyP38Esr4aamB45zFFZjxsbquh9VT7UKcYbexLSKzQ7eBcj6IORIjTvTWU/ypo 9CGu0d7rbMW77dqTy0IboPJ42Mt1Gv7xb5Iv+JVy7xxtN8rOh7TDg7gr4ppSn4nIOLt+ FIVGiyLHUWBTqKE39fjFZQa4cmUd14zJVxlkbtWetC49OmGzMvb+tGwZ1Ct2N3BbJht/ rKkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uNNZt/yv18gqS8vBJLYjcGKjXaiGUN3ckinOpvTC4kA=; b=nQsfvUO7t4CclboqUF6vrX9BjUwhOfdbaOJjZ0hF7p5knXYgcNsTZpUb2TPj8jkSyH rAPhWygyR91IPx6dC9GloGbl92Oyq7+4XduJQ55tF12LlIuLrPghg45g5RNE7W2UHSZu 0XQzSKBwJhNsfx7EpC3FQ064hwo1+QmgBpIYpZmhVSA8SdLokiwB1wfNzR/+I/uLfTzY uw/tzYBQW7F4n3zKM6MS7pUwI2ko6LuLLUd5NxJLXVfWCntVkRz8ZoDzBzM2iBIwR1YT zeDHOa7XPFxldmy354/IhZtiBu41Xk+raTZ2yLIrtQ9DmrJhFlbFTdhq3il/mJJthnlD Quyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EkHvCaij; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g66-v6si13483180pfk.53.2018.09.16.10.05.34; Sun, 16 Sep 2018 10:05:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EkHvCaij; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728233AbeIPW3C (ORCPT + 99 others); Sun, 16 Sep 2018 18:29:02 -0400 Received: from mail-vs1-f67.google.com ([209.85.217.67]:45317 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726949AbeIPW3C (ORCPT ); Sun, 16 Sep 2018 18:29:02 -0400 Received: by mail-vs1-f67.google.com with SMTP id x198-v6so2066730vsx.12 for ; Sun, 16 Sep 2018 10:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uNNZt/yv18gqS8vBJLYjcGKjXaiGUN3ckinOpvTC4kA=; b=EkHvCaijwbAcJorchx1GkyirtC9CCYfrdb7FUqqIGKdnSwR8ILALeW7pRJr9IVvQHn aWqxthf00uzMSaidH00AxzaQk32X9gw0PqVaC8BbfTcZBSK3KM/EqhdXDQJ+6zkxml2M qmrfu3pPl8lf+xALoyevlSLtD0Vn3KRRnICIYi6sHD27KBsbX2xuM1WOti9VaOdp3TIu BVGaOxfSDZJ4A9Tisw5/1VQYQHuaDQgbKsXUzfQ+V++IdQDKEqzSlonJLIez26WrktQe +N5OFKs5cvOPN29yrlj5+kq/maZHb6e9eFb67E/aZmvAbjVDWAzJJoO8dc6Dtvy5x0d3 wtdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uNNZt/yv18gqS8vBJLYjcGKjXaiGUN3ckinOpvTC4kA=; b=JNr8LzUg29f4wc5VlbfMcjpPMi6BvC/T2/6xkg1sU0DF2ppdq8WaYP32VONTPcD80w KPIvNRAnGn40V9QvHJ6EPE6enrYL4zM4fXnVMwhaXqHCJdJEvloq7TxTvScBe0POKwAq eiqmRqoozq4cqD6kKqHufPjUzKpB/FC5bfOH+0hCh6540zbmIR093CX4nD+8LCpYBMhD PnxaZ//t2j52y1SKxI/AT5FuPSdwUTg6eMpFOIYIiVCmBj2wKxUBjSnJZw11g07LYTcx D6XVY1YUJX/lb4m74gNZjvodASZAIiu0GHKPcvdh8bmao+nLsSZw3erqmnpF5rEsz2FM yP6A== X-Gm-Message-State: APzg51DvgKMycqZjWRYXgpyyj9pGmMVXAdJATUMsCyOg8ZrQskvLaHom jCSZKvCaU2JL3tDPG4tGKiYMkitBCas9WoqsC3o= X-Received: by 2002:a67:a89b:: with SMTP id h27-v6mr6784795vsi.18.1537117528870; Sun, 16 Sep 2018 10:05:28 -0700 (PDT) MIME-Version: 1.0 References: <20180916153237.GC15699@rapoport-lnx> In-Reply-To: <20180916153237.GC15699@rapoport-lnx> From: Pintu Kumar Date: Sun, 16 Sep 2018 22:35:17 +0530 Message-ID: Subject: Re: KSM not working in 4.9 Kernel To: rppt@linux.vnet.ibm.com Cc: open list , Russell King - ARM Linux , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 16, 2018 at 9:02 PM Mike Rapoport wrote: > > On Fri, Sep 14, 2018 at 07:58:01PM +0530, Pintu Kumar wrote: > > 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); > > Just mmap'ing an area does not allocate any physical pages, so KSM has > nothing to merge. > > You need to memset(addr,...) after mmap(). > Yes, I am doing memset also. memset(addr, 0xff, size); But still no effect. And I checked LTP test cases. It almost doing the same thing. I observed that [ksmd] thread is not waking up at all. I gave some print inside it, but I could never saw that prints coming. I could not find it running either in top command during the operation. Is there anything needs to be done, to wakw up ksmd? I already set: echo 1 > /sys/kernel/mm/ksm. > > sleep(1); > > } > > printf("Done....press ^C\n"); > > > > pause(); > > > > return 0; > > } > > > > > > > > Thanks, > > Pintu > > > > -- > Sincerely yours, > Mike. >