From patchwork Tue Oct 25 18:41:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9395219 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 2677E6077F for ; Tue, 25 Oct 2016 18:43:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A8B329714 for ; Tue, 25 Oct 2016 18:43:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E9A229716; Tue, 25 Oct 2016 18:43:20 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FF9529714 for ; Tue, 25 Oct 2016 18:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753827AbcJYSnO (ORCPT ); Tue, 25 Oct 2016 14:43:14 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:56367 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759445AbcJYSnL (ORCPT ); Tue, 25 Oct 2016 14:43:11 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.17/8.16.0.17) with SMTP id u9PIgXon003527; Tue, 25 Oct 2016 11:42:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=r2F1OCV/cs9eSudaEKMurXiiB3R9tpXjYTOzsBleBhw=; b=HTwPFIkySSjMD1Y3HghP5XQn0PIKhyP0i1boXrTZrw9sV3yl20pMTFRSNPuxD4hLWvno 3lYwsDj4rZaxlmmabVKBuC+bBu/yyC+qr/XQJj2PSbi2rxQBEl9i29DeWkyj6kH1TDQB BQjw3Qseo5bWyxTZtp/U3+NBM348u4eOH3Y= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 26a8aeue3f-2 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 25 Oct 2016 11:42:43 -0700 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.20) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 25 Oct 2016 11:42:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sJMOPuNYkanY5oh96g8Sm87SslXSwuN/5+kq+D9krtU=; b=HTfHyjVqgKYU0m7KvDcOiJwM8ENkJvT7A9kde6GugiT043c/DUjA+JVHm90CTWLZotwwGwKBdfHugqYI7DL7vxnyDjy1+NcFowJyyyZgr7ydiwbmG5+FLjyuFTMl+VTvUdbBcLhUQZJTPQrF8v5/HQzYnSKxcJM3FLM/vqODj0Y= Received: from localhost (2606:a000:4381:1201:225:22ff:feb3:e51a) by MWHPR15MB1328.namprd15.prod.outlook.com (10.175.3.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.679.12; Tue, 25 Oct 2016 18:42:00 +0000 From: Josef Bacik To: , , , , , , , Subject: [PATCH 2/5] writeback: convert WB_WRITTEN/WB_DIRITED counters to bytes Date: Tue, 25 Oct 2016 14:41:41 -0400 Message-ID: <1477420904-1399-3-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477420904-1399-1-git-send-email-jbacik@fb.com> References: <1477420904-1399-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [2606:a000:4381:1201:225:22ff:feb3:e51a] X-ClientProxiedBy: BN6PR12CA0007.namprd12.prod.outlook.com (10.168.222.17) To MWHPR15MB1328.namprd15.prod.outlook.com (10.175.3.142) X-MS-Office365-Filtering-Correlation-Id: cf280692-e288-42ec-54f4-08d3fd069b24 X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1328; 2:TPJLd7rekIb9XG3xt3ZfLFeAD5LJlX/YC5Cce7D8K8Z0IReJqor2OURtVevhA5JHDxnjtDBDOwQl+0IeSeYO+w6w4/u5BSChT0yeVb7YTuEBhDmFCZBV6S8WLEpEPFTSBGS7WpSrJlGBACsf7HYmh+jDBilam9/uXjPGxaavpuPw7TUt4KDuY6h0PfJ8esc9bClMN3PGQh5JXpRdBgoQfg==; 3:U3VKMv0uQBH0gQy9dxJMa2fbghpb5dRmGI/2ChKaTwzAtkr2fp2O4L7e1AwjkTaMuamUXXVkFet2N+i+OG2LpFbqRmeM9N7p8DYNUGj9dB6pthYINA7cNG3hK9IKt517xKUm6tiwgYSUe5byhYiRKQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:MWHPR15MB1328; X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1328; 25:dAe/XF113W/qr005Dqcrlii7PxrxmCioY0Hk5zDru3Sp/mqGcr8delIK4blWd4ocyao7usYKmaZN8IbxilaZpy96ckDhIOnJLh/XSnESvD26s4FcRGgLcs9+6leqcC15BZQB7dA4D4bApbFYx+SUknIRRH9z5Wkpz4xaVbxQPuI/QhoFWTVQ/nmgOkC4vUaqcxcmPmKlWSiPwpNva3C3doVuxCzjiu15ZqZ/iEZqg5lWmktslasSc5xxd9drOwfKdXICgtVYJ3CKgx5Pp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Iz4DK6Mv1QNuSHRkqHXKCQULb83ZWPaawRhgOXUcTSPAZk4+STaItvx7nft/VcTyO+gT/I7RIKc0qVeule5O5ENEIgVKGiagYE0IgWVo9OrGFHplPsYs3oH4L16xvFBPiLf+dhjaarS8cNSjm8ihqrET+m9fW4IxW1UigbVuYg0Ff/NALPKaeEiAClHKJynj7nfHRfMCiVX7RCsuBqmboIJgJFi7mRIFxgl3JlvxR+6bO5rYah65kRgTjQGa9wUMTrt142nAYN6iWM1BPtbz3m1n9m9BToRkxb2SpjIg8GXbYIU9d/J3CAN87J9ydau1mw/2Ay/erqmliHXl4b3gZbvH9vMeLQZqyze9it2I4xvXq3I1RD1dwvC5eIQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:MWHPR15MB1328; BCL:0; PCL:0; RULEID:; SRVR:MWHPR15MB1328; X-Forefront-PRVS: 01068D0A20 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(77096005)(101416001)(189998001)(76506005)(50466002)(229853001)(48376002)(5003940100001)(50226002)(5660300001)(68736007)(8676002)(6636002)(81156014)(6666003)(42186005)(33646002)(107886002)(2950100002)(106356001)(586003)(76176999)(86362001)(6116002)(7736002)(7846002)(19580405001)(19580395003)(5001770100001)(81166006)(105586002)(2906002)(2201001)(50986999)(305945005)(47776003)(97736004)(92566002)(36756003); DIR:OUT; SFP:1102; SCL:1; SRVR:MWHPR15MB1328; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR15MB1328; 23:VpliGTK4eLHcfIFu9ec5b8ogMLJKZ1XRA+rJPcCmF?= =?us-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W0qM5OsaoUhmYa4oG4Ol9h4DPa9Wdyy5A9WslMX8gwHC5VO7+QkZVoDl6sH9lk3/eRA/vf8yZCT3mi+oUcm/rB1McwmIs+4V8XsOTOwOVJS57ANmWdc2qW0ihd/DzDf8uq9QSmVZhRyeUOdWw+Wh16ni+li42NUAcA9tXMIUo4bX/lC6KgqhUFGslyVb iMGCpP9KVCh4aU9dEH5GjyxBpVa5QVPs8Rg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR15MB1328; 20:CAyBYzHO0DLY0eZpq/b5d4OORpXK6SsU+wtG4F42uAsMbzYN4KaYc4F+nNkIcSq20Fvnz6z0pr6piiovD4M7gx7mvCDd9oRASNQ8cjrBMBU/+THyWLYPN8KiFQBOqTCPHoC9Oz4ehJTorG15uEevbjD/wzJwPmI/dnakSjP2OEE= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2016 18:42:00.1430 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR15MB1328 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-25_18:, , signatures=0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These are counters that constantly go up in order to do bandwidth calculations. It isn't important what the units are in, as long as they are consistent between the two of them, so convert them to count bytes written/dirtied, and allow the metadata accounting stuff to change the counters as well. Signed-off-by: Josef Bacik Acked-by: Tejun Heo --- fs/fuse/file.c | 4 ++-- include/linux/backing-dev-defs.h | 4 ++-- include/linux/backing-dev.h | 2 +- mm/backing-dev.c | 9 +++++---- mm/page-writeback.c | 26 +++++++++++++++----------- 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 3988b43..81eee7e 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1467,7 +1467,7 @@ static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) for (i = 0; i < req->num_pages; i++) { dec_wb_stat(&bdi->wb, WB_WRITEBACK); dec_node_page_state(req->pages[i], NR_WRITEBACK_TEMP); - wb_writeout_inc(&bdi->wb); + wb_writeout_add(&bdi->wb, PAGE_SIZE); } wake_up(&fi->page_waitq); } @@ -1771,7 +1771,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req, dec_wb_stat(&bdi->wb, WB_WRITEBACK); dec_node_page_state(page, NR_WRITEBACK_TEMP); - wb_writeout_inc(&bdi->wb); + wb_writeout_add(&bdi->wb, PAGE_SIZE); fuse_writepage_free(fc, new_req); fuse_request_free(new_req); goto out; diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index c357f27..71ea5a6 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -34,8 +34,8 @@ typedef int (congested_fn)(void *, int); enum wb_stat_item { WB_RECLAIMABLE, WB_WRITEBACK, - WB_DIRTIED, - WB_WRITTEN, + WB_DIRTIED_BYTES, + WB_WRITTEN_BYTES, NR_WB_STAT_ITEMS }; diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 9eb2cf2..edddcb8 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -114,7 +114,7 @@ static inline s64 wb_stat_sum(struct bdi_writeback *wb, enum wb_stat_item item) return sum; } -extern void wb_writeout_inc(struct bdi_writeback *wb); +extern void wb_writeout_add(struct bdi_writeback *wb, long bytes); /* * maximal error of a stat counter. diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 8fde443..433db42 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -70,14 +70,15 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) wb_thresh = wb_calc_thresh(wb, dirty_thresh); #define K(x) ((x) << (PAGE_SHIFT - 10)) +#define BtoK(x) ((x) >> 10) seq_printf(m, "BdiWriteback: %10lu kB\n" "BdiReclaimable: %10lu kB\n" "BdiDirtyThresh: %10lu kB\n" "DirtyThresh: %10lu kB\n" "BackgroundThresh: %10lu kB\n" - "BdiDirtied: %10lu kB\n" - "BdiWritten: %10lu kB\n" + "BdiDirtiedBytes: %10lu kB\n" + "BdiWrittenBytes: %10lu kB\n" "BdiWriteBandwidth: %10lu kBps\n" "b_dirty: %10lu\n" "b_io: %10lu\n" @@ -90,8 +91,8 @@ static int bdi_debug_stats_show(struct seq_file *m, void *v) K(wb_thresh), K(dirty_thresh), K(background_thresh), - (unsigned long) K(wb_stat(wb, WB_DIRTIED)), - (unsigned long) K(wb_stat(wb, WB_WRITTEN)), + (unsigned long) BtoK(wb_stat(wb, WB_DIRTIED_BYTES)), + (unsigned long) BtoK(wb_stat(wb, WB_WRITTEN_BYTES)), (unsigned long) K(wb->write_bandwidth), nr_dirty, nr_io, diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 121a6e3..e09b3ad 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -596,11 +596,11 @@ static void wb_domain_writeout_inc(struct wb_domain *dom, * Increment @wb's writeout completion count and the global writeout * completion count. Called from test_clear_page_writeback(). */ -static inline void __wb_writeout_inc(struct bdi_writeback *wb) +static inline void __wb_writeout_inc(struct bdi_writeback *wb, long bytes) { struct wb_domain *cgdom; - __inc_wb_stat(wb, WB_WRITTEN); + __add_wb_stat(wb, WB_WRITTEN_BYTES, bytes); wb_domain_writeout_inc(&global_wb_domain, &wb->completions, wb->bdi->max_prop_frac); @@ -610,15 +610,15 @@ static inline void __wb_writeout_inc(struct bdi_writeback *wb) wb->bdi->max_prop_frac); } -void wb_writeout_inc(struct bdi_writeback *wb) +void wb_writeout_add(struct bdi_writeback *wb, long bytes) { unsigned long flags; local_irq_save(flags); - __wb_writeout_inc(wb); + __wb_writeout_inc(wb, bytes); local_irq_restore(flags); } -EXPORT_SYMBOL_GPL(wb_writeout_inc); +EXPORT_SYMBOL_GPL(wb_writeout_add); /* * On idle system, we can be called long after we scheduled because we use @@ -1362,8 +1362,8 @@ static void __wb_update_bandwidth(struct dirty_throttle_control *gdtc, if (elapsed < BANDWIDTH_INTERVAL) return; - dirtied = percpu_counter_read(&wb->stat[WB_DIRTIED]); - written = percpu_counter_read(&wb->stat[WB_WRITTEN]); + dirtied = percpu_counter_read(&wb->stat[WB_DIRTIED_BYTES]) >> PAGE_SHIFT; + written = percpu_counter_read(&wb->stat[WB_WRITTEN_BYTES]) >> PAGE_SHIFT; /* * Skip quiet periods when disk bandwidth is under-utilized. @@ -2464,7 +2464,7 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) __inc_zone_page_state(page, NR_ZONE_WRITE_PENDING); __inc_node_page_state(page, NR_DIRTIED); __inc_wb_stat(wb, WB_RECLAIMABLE); - __inc_wb_stat(wb, WB_DIRTIED); + __add_wb_stat(wb, WB_DIRTIED_BYTES, PAGE_SIZE); task_io_account_write(PAGE_SIZE); current->nr_dirtied++; this_cpu_inc(bdp_ratelimits); @@ -2547,12 +2547,16 @@ void account_page_redirty(struct page *page) if (mapping && mapping_cap_account_dirty(mapping)) { struct inode *inode = mapping->host; struct bdi_writeback *wb; + unsigned long flags; bool locked; wb = unlocked_inode_to_wb_begin(inode, &locked); current->nr_dirtied--; - dec_node_page_state(page, NR_DIRTIED); - dec_wb_stat(wb, WB_DIRTIED); + + local_irq_save(flags); + __dec_node_page_state(page, NR_DIRTIED); + __add_wb_stat(wb, WB_DIRTIED_BYTES, -(long)PAGE_SIZE); + local_irq_restore(flags); unlocked_inode_to_wb_end(inode, locked); } } @@ -2772,7 +2776,7 @@ int test_clear_page_writeback(struct page *page) struct bdi_writeback *wb = inode_to_wb(inode); __dec_wb_stat(wb, WB_WRITEBACK); - __wb_writeout_inc(wb); + __wb_writeout_inc(wb, PAGE_SIZE); } }