lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1498230681-29103-1-git-send-email-nborisov@suse.com>
Date:   Fri, 23 Jun 2017 18:11:21 +0300
From:   Nikolay Borisov <nborisov@...e.com>
To:     tj@...nel.org
Cc:     jack@...e.cz, axboe@...com, linux-kernel@...r.kernel.org,
        Nikolay Borisov <nborisov@...e.com>
Subject: [PATCH] writeback: Simplify wb_stat_sum

wb_stat_sum disables interrupts and calls __wb_stat_sum which eventually calls
__percpu_counter_sum. However, the percpu routine is already irq-safe. Simplify
the code a bit by making wb_stat_sum directly call percpu_counter_sum_positive
and not disable interrupts. Also remove the now-uneeded __wb_stat_sum which was
just a wrapper over percpu_counter_sum_positive

Signed-off-by: Nikolay Borisov <nborisov@...e.com>
---
 include/linux/backing-dev.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index e9c967b86054..854e1bdd0b2a 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -84,22 +84,9 @@ static inline s64 wb_stat(struct bdi_writeback *wb, enum wb_stat_item item)
 	return percpu_counter_read_positive(&wb->stat[item]);
 }
 
-static inline s64 __wb_stat_sum(struct bdi_writeback *wb,
-				enum wb_stat_item item)
-{
-	return percpu_counter_sum_positive(&wb->stat[item]);
-}
-
 static inline s64 wb_stat_sum(struct bdi_writeback *wb, enum wb_stat_item item)
 {
-	s64 sum;
-	unsigned long flags;
-
-	local_irq_save(flags);
-	sum = __wb_stat_sum(wb, item);
-	local_irq_restore(flags);
-
-	return sum;
+	return percpu_counter_sum_positive(&wb->stat[item]);
 }
 
 extern void wb_writeout_inc(struct bdi_writeback *wb);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ