Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932332AbcCHBrn (ORCPT ); Mon, 7 Mar 2016 20:47:43 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34312 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932069AbcCHBrh (ORCPT ); Mon, 7 Mar 2016 20:47:37 -0500 From: Naoya Horiguchi To: linux-mm@kvack.org Cc: Andrew Morton , Vladimir Davydov , Konstantin Khlebnikov , linux-kernel@vger.kernel.org, Naoya Horiguchi , Naoya Horiguchi Subject: [PATCH v1] tools/vm/page-types.c: remove memset() in walk_pfn() Date: Tue, 8 Mar 2016 10:47:32 +0900 Message-Id: <1457401652-9226-1-git-send-email-n-horiguchi@ah.jp.nec.com> X-Mailer: git-send-email 2.7.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1344 Lines: 40 I found that page-types is very slow and my testing shows many timeout errors. Here's an example with a simple program allocating 1000 thps. $ time ./page-types -p $(pgrep -f test_alloc) ... real 0m17.201s user 0m16.889s sys 0m0.312s $ time ./page-types.patched -p $(pgrep -f test_alloc) ... real 0m0.182s user 0m0.046s sys 0m0.135s Most of time is spent in memset(), which isn't necessary because we check that the return of kpagecgroup_read() is equal to pages and uninitialized memory is never used. So we can drop this memset(). Fixes: 954e95584579 ("tools/vm/page-types.c: add memory cgroup dumping and filtering") Signed-off-by: Naoya Horiguchi --- tools/vm/page-types.c | 2 -- 1 file changed, 2 deletions(-) diff --git v4.5-rc5-mmotm-2016-02-24-16-18/tools/vm/page-types.c v4.5-rc5-mmotm-2016-02-24-16-18_patched/tools/vm/page-types.c index dab61c3..c192baf 100644 --- v4.5-rc5-mmotm-2016-02-24-16-18/tools/vm/page-types.c +++ v4.5-rc5-mmotm-2016-02-24-16-18_patched/tools/vm/page-types.c @@ -633,8 +633,6 @@ static void walk_pfn(unsigned long voffset, unsigned long pages; unsigned long i; - memset(cgi, 0, sizeof cgi); - while (count) { batch = min_t(unsigned long, count, KPAGEFLAGS_BATCH); pages = kpageflags_read(buf, index, batch); -- 2.7.0