Received: by 10.223.185.111 with SMTP id b44csp1654300wrg; Sat, 10 Mar 2018 10:42:27 -0800 (PST) X-Google-Smtp-Source: AG47ELsYZkQKqsuXBSQiVKFOs+frhQJAVSAl5F8Qq2cJfRPs0cb/gTqfN198MiMS8vgl4Gx479O/ X-Received: by 10.101.89.74 with SMTP id g10mr2220753pgu.415.1520707347176; Sat, 10 Mar 2018 10:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520707347; cv=none; d=google.com; s=arc-20160816; b=jtW/FrEmZLDtZ2COPwS8NUYF7O6kc77HCMY9E2C97hB1sXEfGmovBf+lISCwv4pA3P mdMSME9rwigJNSP/cQgnP2FA2IYiUWz81a3FWsQkv9txjHA9Z/ELmVu1cZg/7YC4Uy98 tN8lbLQLwbumsWLN+MZ5DYhPa7zrUYbq2F8mKsaPoSQHjQZZfW8nMAowPVoSzh46L8gu Rkx+4A4NtmKFaII/IDJ4Tu1abt6XB9mkIqyvrNiIsm/FkqINxQlPoKWJNxCG6PHOaH3B 7XTwzxg9fF//59hm8EJ7GtiH50/UiWUPiUUoE3fAG4jiCWuukPvDjcjS0Iv6ecMv9Bkj RKXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=cQqeYBDHLbKOJnC8LPVlkDsr6F/HPevkBrwdSkWjjiA=; b=VD9SuZNBbgvURa81AlHazcySHEqMq/0ARQ2iPkFNzWiE7z67lXFtUaqCIvv33bQlDY gud0e1aqb1oKZ1lDFVANFNX3FbEwDOMRqxjjNWcCgQYfzhtcomjLv+Y4B1q8VOCOYEAV PlveQM1bjUWjpsEjzRbYgpq6dlq0L6jIliZYhwBTYOMPHB/gE1/f6fSc1hhVHbzD1kHs Qz9bO6zOwigipAHV7ysRuKEdM5CED1nEzi7EjlSb/Ntwrwf+DMa/XmpSfVurZBzFXI7d lFc5c9Hf4ky0JPL+/+xu4SzUbKPMtEKxMld1+zZTpyb1sKWrRlxCYJfw9FzTPFRt+q5G eVxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eng.ucsd.edu header.s=google header.b=SG9Eg/Ex; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si3032734pfj.366.2018.03.10.10.42.12; Sat, 10 Mar 2018 10:42:27 -0800 (PST) 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=@eng.ucsd.edu header.s=google header.b=SG9Eg/Ex; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932370AbeCJSUm (ORCPT + 99 others); Sat, 10 Mar 2018 13:20:42 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:40605 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932302AbeCJSUi (ORCPT ); Sat, 10 Mar 2018 13:20:38 -0500 Received: by mail-pg0-f65.google.com with SMTP id g8so4832347pgv.7 for ; Sat, 10 Mar 2018 10:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eng.ucsd.edu; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cQqeYBDHLbKOJnC8LPVlkDsr6F/HPevkBrwdSkWjjiA=; b=SG9Eg/Exjoht3riRHBFBYtfu39yVztjc71FIK8EV8q9/LyLDhCEBdUNp4cpza5HVPa w0PxvKpQ+mMw5ngpZ5e4/jrEF0YELOItbVkGfWIofTxVb344jK8E9OHAOjz0Ht+O73m4 W8a/moYkY9Kd7DyBj88doR05wQtZ00/9thpz0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cQqeYBDHLbKOJnC8LPVlkDsr6F/HPevkBrwdSkWjjiA=; b=ngbiOB5MX3dLty4adCwlkeyGSi2EBcPB6Ms6dJwb+z7x4AUFkSHgIGhzGs9HYkQi4i ZI3Rx4oiC7hIZDju2G1GiU8ZoBNKfaTmFabICd1FABd+6fAU7Kx14bneCbs3DTBEye31 iMY7Lbl3mbXNiq96jSCdglDR2dcSH1XA0oiVFo0gEliGNPgVHIvf9lpQFS8RVClF2Xlx MR0YAA5EMiIHM5h5KzFJeMCNG1wDCgdwS/lIQq9M6IG3YMdkv6JhnJlUA8LCqFLThEDG OBGelvj9Mr3u/as52sBqHpMNi+lemoHqtmfhiSW+OhAEqNgbVmPLyJ/m3c4I4k/tpJiQ K7rg== X-Gm-Message-State: AElRT7FJQ3epwZyFwDDweUVpaqaFt8a7TgLLo9mMM0EujAEbUNE/Ine5 rASnCpGRxRxGqe9Tt3C7f7Ap+A== X-Received: by 10.99.127.92 with SMTP id p28mr2236735pgn.305.1520706037896; Sat, 10 Mar 2018 10:20:37 -0800 (PST) Received: from brienza-desktop.8.8.4.4 (andxu.ucsd.edu. [132.239.17.134]) by smtp.gmail.com with ESMTPSA id h80sm9210167pfj.181.2018.03.10.10.20.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 10:20:37 -0800 (PST) From: Andiry Xu To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Cc: dan.j.williams@intel.com, andy.rudoff@intel.com, coughlan@redhat.com, swanson@cs.ucsd.edu, david@fromorbit.com, jack@suse.com, swhiteho@redhat.com, miklos@szeredi.hu, andiry.xu@gmail.com, Andiry Xu Subject: [RFC v2 18/83] Add freelist statistics printing. Date: Sat, 10 Mar 2018 10:17:59 -0800 Message-Id: <1520705944-6723-19-git-send-email-jix024@eng.ucsd.edu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> References: <1520705944-6723-1-git-send-email-jix024@eng.ucsd.edu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andiry Xu Signed-off-by: Andiry Xu --- fs/nova/nova.h | 1 + fs/nova/stats.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) diff --git a/fs/nova/nova.h b/fs/nova/nova.h index c4abdd8..404e133 100644 --- a/fs/nova/nova.h +++ b/fs/nova/nova.h @@ -326,5 +326,6 @@ void nova_get_IO_stats(void); void nova_print_timing_stats(struct super_block *sb); void nova_clear_stats(struct super_block *sb); void nova_print_inode(struct nova_inode *pi); +void nova_print_free_lists(struct super_block *sb); #endif /* __NOVA_H */ diff --git a/fs/nova/stats.c b/fs/nova/stats.c index 4b7c317..9ddd267 100644 --- a/fs/nova/stats.c +++ b/fs/nova/stats.c @@ -128,6 +128,61 @@ DEFINE_PER_CPU(u64[TIMING_NUM], Countstats_percpu); u64 IOstats[STATS_NUM]; DEFINE_PER_CPU(u64[STATS_NUM], IOstats_percpu); +static void nova_print_alloc_stats(struct super_block *sb) +{ + struct nova_sb_info *sbi = NOVA_SB(sb); + struct free_list *free_list; + unsigned long alloc_log_count = 0; + unsigned long alloc_log_pages = 0; + unsigned long alloc_data_count = 0; + unsigned long alloc_data_pages = 0; + unsigned long free_log_count = 0; + unsigned long freed_log_pages = 0; + unsigned long free_data_count = 0; + unsigned long freed_data_pages = 0; + int i; + + nova_info("=========== NOVA allocation stats ===========\n"); + nova_info("Alloc %llu, alloc steps %llu, average %llu\n", + Countstats[new_data_blocks_t], IOstats[alloc_steps], + Countstats[new_data_blocks_t] ? + IOstats[alloc_steps] / Countstats[new_data_blocks_t] + : 0); + nova_info("Free %llu\n", Countstats[free_data_t]); + nova_info("Fast GC %llu, check pages %llu, free pages %llu, average %llu\n", + Countstats[fast_gc_t], IOstats[fast_checked_pages], + IOstats[fast_gc_pages], Countstats[fast_gc_t] ? + IOstats[fast_gc_pages] / Countstats[fast_gc_t] : 0); + nova_info("Thorough GC %llu, checked pages %llu, free pages %llu, average %llu\n", + Countstats[thorough_gc_t], + IOstats[thorough_checked_pages], IOstats[thorough_gc_pages], + Countstats[thorough_gc_t] ? + IOstats[thorough_gc_pages] / Countstats[thorough_gc_t] + : 0); + + for (i = 0; i < sbi->cpus; i++) { + free_list = nova_get_free_list(sb, i); + + alloc_log_count += free_list->alloc_log_count; + alloc_log_pages += free_list->alloc_log_pages; + alloc_data_count += free_list->alloc_data_count; + alloc_data_pages += free_list->alloc_data_pages; + free_log_count += free_list->free_log_count; + freed_log_pages += free_list->freed_log_pages; + free_data_count += free_list->free_data_count; + freed_data_pages += free_list->freed_data_pages; + } + + nova_info("alloc log count %lu, allocated log pages %lu, " + "alloc data count %lu, allocated data pages %lu, " + "free log count %lu, freed log pages %lu, " + "free data count %lu, freed data pages %lu\n", + alloc_log_count, alloc_log_pages, + alloc_data_count, alloc_data_pages, + free_log_count, freed_log_pages, + free_data_count, freed_data_pages); +} + static void nova_print_IO_stats(struct super_block *sb) { nova_info("=========== NOVA I/O stats ===========\n"); @@ -209,6 +264,7 @@ void nova_print_timing_stats(struct super_block *sb) } nova_info("\n"); + nova_print_alloc_stats(sb); nova_print_IO_stats(sb); } @@ -229,6 +285,8 @@ static void nova_clear_timing_stats(void) static void nova_clear_IO_stats(struct super_block *sb) { + struct nova_sb_info *sbi = NOVA_SB(sb); + struct free_list *free_list; int i; int cpu; @@ -237,6 +295,19 @@ static void nova_clear_IO_stats(struct super_block *sb) for_each_possible_cpu(cpu) per_cpu(IOstats_percpu[i], cpu) = 0; } + + for (i = 0; i < sbi->cpus; i++) { + free_list = nova_get_free_list(sb, i); + + free_list->alloc_log_count = 0; + free_list->alloc_log_pages = 0; + free_list->alloc_data_count = 0; + free_list->alloc_data_pages = 0; + free_list->free_log_count = 0; + free_list->freed_log_pages = 0; + free_list->free_data_count = 0; + free_list->freed_data_pages = 0; + } } void nova_clear_stats(struct super_block *sb) @@ -261,3 +332,35 @@ void nova_print_inode(struct nova_inode *pi) nova_dbg("create epoch id %llu, delete epoch id %llu\n", pi->create_epoch_id, pi->delete_epoch_id); } + +void nova_print_free_lists(struct super_block *sb) +{ + struct nova_sb_info *sbi = NOVA_SB(sb); + struct free_list *free_list; + int i; + + nova_dbg("======== NOVA per-CPU free list allocation stats ========\n"); + for (i = 0; i < sbi->cpus; i++) { + free_list = nova_get_free_list(sb, i); + nova_dbg("Free list %d: block start %lu, block end %lu, " + "num_blocks %lu, num_free_blocks %lu, blocknode %lu\n", + i, free_list->block_start, free_list->block_end, + free_list->block_end - free_list->block_start + 1, + free_list->num_free_blocks, free_list->num_blocknode); + + nova_dbg("Free list %d: alloc log count %lu, " + "allocated log pages %lu, alloc data count %lu, " + "allocated data pages %lu, free log count %lu, " + "freed log pages %lu, free data count %lu, " + "freed data pages %lu\n", + i, + free_list->alloc_log_count, + free_list->alloc_log_pages, + free_list->alloc_data_count, + free_list->alloc_data_pages, + free_list->free_log_count, + free_list->freed_log_pages, + free_list->free_data_count, + free_list->freed_data_pages); + } +} -- 2.7.4