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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 May 2011 12:18:16 -0400
From:	Christoph Hellwig <hch@...radead.org>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, Jan Kara <jack@...e.cz>,
	Dave Chinner <david@...morbit.com>,
	LKML <linux-kernel@...r.kernel.org>,
	"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH 3/6] writeback: make nr_to_write a per-file limit

> - move MAX_WRITEBACK_PAGES and wb_writeback_work definitions to writeback.h

I think it would be a good idea to keep this in fs/fs-writeback.c, which
means we'd need a small writeback_inodes_wb wrapper for
balance_dirty_pages and bdi_flush_io.  But IIRC your tree already has
__writeback_inodes_wb for use in wb_writeback, so writeback_inodes_wb
could be that wrapper.

> +	long write_chunk = MAX_WRITEBACK_PAGES;
> +	long wrote = 0;
> +	bool inode_cleaned = false;
> +
> +	/*
> +	 * WB_SYNC_ALL mode does livelock avoidance by syncing dirty
> +	 * inodes/pages in one big loop. Setting wbc.nr_to_write=LONG_MAX
> +	 * here avoids calling into writeback_inodes_wb() more than once.
> +	 *
> +	 * The intended call sequence for WB_SYNC_ALL writeback is:
> +	 *
> +	 *      wb_writeback()
> +	 *          writeback_sb_inodes()       <== called only once
> +	 *              write_cache_pages()     <== called once for each inode
> +	 *                   (quickly) tag currently dirty pages
> +	 *                   (maybe slowly) sync all tagged pages
> +	 */
> +	if (work->sync_mode == WB_SYNC_ALL || work->tagged_sync)
> +		write_chunk = LONG_MAX;

I think this would be easier to read if kept as and if / else clause
with the MAX_WRITEBACK_PAGES usage.

> +		write_chunk = min(write_chunk, work->nr_pages);

Or in fact done here - for the WB_SYNC_ALL case LONG_MAX should
always be larger than work->nr_pages, so the whole thing could be
simplified to:

		if (work->sync_mode == WB_SYNC_ALL || work->tagged_sync)
			write_chunk = LONG_MAX;
		else
			write_chunk = min(MAX_WRITEBACK_PAGES, work->nr_pages);


Other notes:

 - older_than_this in writeback_control shouldn't be needed anymore
 - is the early return for the mis-matching sb in writeback_sb_inodes
   handled correctly?  Before it had the special 0 return value, and
   I'm not quite sure how that fits into your new enum scheme.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists