mm: cleanup backing_dev_info foo_stamp fields
Subsystems (4)
PATCH 1/1 mm: cleanup backing_dev_info foo_stamp fields
State clearly that bw_time_stamp is measured in jiffies. Rename other foo_stamp fields to reflect that they are in units of number-of-pages.
Reported-by Andrew Morton <[email protected]>
Signed-off-by Maxim Patlasov <[email protected]>
--- include/linux/backing-dev.h | 7 ++++--- mm/backing-dev.c | 2 +- mm/page-writeback.c | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-)
include/linux/backing-dev.h +4 -3
@@ -73,9 +73,10 @@ struct backing_dev_info {struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS ]; -unsigned long bw_time_stamp;/* last time write bw is updated */ -unsigned long dirtied_stamp; -unsigned long written_stamp;/* pages written at bw_time_stamp */ +unsigned long bw_time_stamp;/* last time (in jiffies) write bw +* is updated */ +unsigned long dirtied_nr_stamp; +unsigned long written_nr_stamp;/* pages written at bw_time_stamp */ unsigned long write_bandwidth;/* the estimated write bandwidth */ unsigned long avg_write_bandwidth;/* further smoothed write bw */
mm/backing-dev.c +1 -1
@@ -454,7 +454,7 @@ int bdi_init(struct backing_dev_info *bdi) bdi->dirty_exceeded =0 ; bdi->bw_time_stamp = jiffies; - bdi->written_stamp =0 ; + bdi->written_nr_stamp =0 ; bdi->balanced_dirty_ratelimit =INIT_BW ; bdi->dirty_ratelimit =INIT_BW ;
mm/page-writeback.c +4 -4
@@ -799,7 +799,7 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi,* write_bandwidth = --------------------------------------------------- * period */ - bw = written - bdi->written_stamp; + bw = written - bdi->written_nr_stamp; bw *=HZ ;if (unlikely (elapsed > period)) {do_div (bw, elapsed);
@@ -910,7 +910,7 @@ static void bdi_update_dirty_ratelimit(struct backing_dev_info *bdi,* The dirty rate will match the writeout rate in long term, except * when dirty pages are truncated by userspace or re-dirtied by FS. */ - dirty_rate = (dirtied - bdi->dirtied_stamp) *HZ / elapsed; + dirty_rate = (dirtied - bdi->dirtied_nr_stamp) *HZ / elapsed; pos_ratio =bdi_position_ratio (bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty);
@@ -1066,8 +1066,8 @@ void __bdi_update_bandwidth(struct backing_dev_info *bdi,bdi_update_write_bandwidth (bdi, elapsed, written); snapshot: - bdi->dirtied_stamp = dirtied; - bdi->written_stamp = written; + bdi->dirtied_nr_stamp = dirtied; + bdi->written_nr_stamp = written; bdi->bw_time_stamp = now; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Maxim Patlasov
State clearly that
bw_time_stampis measured in jiffies. Rename otherfoo_stampfields to reflect that they are in units of number-of-pages.Reported-by Andrew Morton <[email protected]>Signed-off-by Maxim Patlasov <[email protected]>
Looks good. You can add:
Reviewed-by Jan Kara <[email protected]>
Honza
Quoted 71 lines
--- include/linux/backing-dev.h | 7 ++++--- mm/backing-dev.c | 2 +- mm/page-writeback.c | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-)include/linux/backing-dev.h +4
-3@@ -73,9 +73,10 @@ struct backing_dev_info {struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS ]; -unsigned long bw_time_stamp;/* last time write bw is updated */ -unsigned long dirtied_stamp; -unsigned long written_stamp;/* pages written at bw_time_stamp */ +unsigned long bw_time_stamp;/* last time (in jiffies) write bw +* is updated */ +unsigned long dirtied_nr_stamp; +unsigned long written_nr_stamp;/* pages written at bw_time_stamp */ unsigned long write_bandwidth;/* the estimated write bandwidth */ unsigned long avg_write_bandwidth;/* further smoothed write bw */ mm/backing-dev.c +1
-1@@ -454,7 +454,7 @@ int bdi_init(struct backing_dev_info *bdi) bdi->dirty_exceeded =0 ; bdi->bw_time_stamp = jiffies; - bdi->written_stamp =0 ; + bdi->written_nr_stamp =0 ; bdi->balanced_dirty_ratelimit =INIT_BW ; bdi->dirty_ratelimit =INIT_BW ;mm/page-writeback.c +4
-4@@ -799,7 +799,7 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi,* write_bandwidth = --------------------------------------------------- * period */ - bw = written - bdi->written_stamp; + bw = written - bdi->written_nr_stamp; bw *=HZ ;if (unlikely (elapsed > period)) {do_div (bw, elapsed);@@ -910,7 +910,7 @@ static void bdi_update_dirty_ratelimit(struct backing_dev_info *bdi,* The dirty rate will match the writeout rate in long term, except * when dirty pages are truncated by userspace or re-dirtied by FS. */ - dirty_rate = (dirtied - bdi->dirtied_stamp) *HZ / elapsed; + dirty_rate = (dirtied - bdi->dirtied_nr_stamp) *HZ / elapsed; pos_ratio =bdi_position_ratio (bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty);@@ -1066,8 +1066,8 @@ void __bdi_update_bandwidth(struct backing_dev_info *bdi,bdi_update_write_bandwidth (bdi, elapsed, written); snapshot: - bdi->dirtied_stamp = dirtied; - bdi->written_stamp = written; + bdi->dirtied_nr_stamp = dirtied; + bdi->written_nr_stamp = written; bdi->bw_time_stamp = now; }
Signature · 8 lines
Jan Kara <[email protected]> SUSE Labs, CR -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>