From patchwork Sat Mar 10 18:17:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andiry Xu X-Patchwork-Id: 10273843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54ED9601A0 for ; Sat, 10 Mar 2018 18:20:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 446D029106 for ; Sat, 10 Mar 2018 18:20:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 393E02975F; Sat, 10 Mar 2018 18:20:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4CD329106 for ; Sat, 10 Mar 2018 18:20:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9C28B2253FB6C; Sat, 10 Mar 2018 10:14:22 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::244; helo=mail-pg0-x244.google.com; envelope-from=jix024@eng.ucsd.edu; receiver=linux-nvdimm@lists.01.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 70DA72258AEE0 for ; Sat, 10 Mar 2018 10:14:19 -0800 (PST) Received: by mail-pg0-x244.google.com with SMTP id a15so484170pgn.5 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=j7Km7hcP06QMFUH9rjh9a3Xdofezxxp8OhUYmDgl2cKt/whqz+UF+AlJeXUlVfY/jo 4Frn2rhcTb3yNQkV/6HSrXyrBo5qM0hvQxcZlhVV3HFwoxNhmGguFNmCLLCXLM1ac13x tzubBSF4J1+6BiL65VuyMxqRMz151uxoiogyIyJ7D/74P9EZswCdM8it+Mc417IrnuWU XNWpWkmZ+45yy4PwrGYiqqKzMVFXWFe5YyLk9SCxy1Wb0j9PPE220V3MtHoorQDyNgB2 qYz7pCHAg/DwDcS2Fd9B0K2lLfU41xXWGkiH25wmHJhFuBl5KgIfAp7/5Z7ayKFpOBWp 9YYA== X-Gm-Message-State: AElRT7ELg9sq6wLRj+UYB4Sxqw/7armHIlOJKUkHSxew4x06FLo2SAm8 b5UBhIrBvCueuDtLlYruLC7l6Q== X-Google-Smtp-Source: AG47ELsbDFaIvjmeIC2e5tAfzxYYUIxy5iD5BJegAuNiVyfyefOsIE/BgN8c2w8IGta1EhsU//cE0Q== 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 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> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: coughlan@redhat.com, miklos@szeredi.hu, Andiry Xu , david@fromorbit.com, jack@suse.com, swanson@cs.ucsd.edu, swhiteho@redhat.com, andiry.xu@gmail.com MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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); + } +}