login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
August
»
20
Re: [PATCH 1/3] mm: helper functions for dirty and writeback accounting
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Michael Rubin
Subject:
Re: [PATCH 1/3] mm: helper functions for dirty and writeback accounting
Date: Friday, August 20, 2010 - 1:19 am
On Thu, Aug 19, 2010 at 7:34 PM, Wu Fengguang <fengguang.wu@intel.com> wrote:
quoted text
> On Thu, Aug 19, 2010 at 01:57:25PM -0700, Michael Rubin wrote: >> Exporting account_pages_dirty and adding a symmetric routine >> account_pages_writeback. > > s/account_pages_writeback/account_page_writeback/
Got it. thanks.
quoted text
> I'd recommend to separate the changes into two patches. > It's actually a bug fix to export account_pages_dirty() for ceph, > which should be a good candidate for 2.6.36.
Good idea.
quoted text
>> This allows code outside of the mm core to safely manipulate page state >> and not worry about the other accounting. Not using these routines means >> that some code will lose track of the accounting and we get bugs. This >> has happened once already. >> >> Signed-off-by: Michael Rubin <mrubin@google.com> >> --- >> fs/ceph/addr.c | 8 ++------ >> fs/nilfs2/segment.c | 2 +- >> include/linux/mm.h | 1 + >> mm/page-writeback.c | 15 +++++++++++++++ >> 4 files changed, 19 insertions(+), 7 deletions(-) >> >> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c >> index d9c60b8..359aa3a 100644 >> --- a/fs/ceph/addr.c >> +++ b/fs/ceph/addr.c >> @@ -106,12 +106,8 @@ static int ceph_set_page_dirty(struct page *page) >> if (page->mapping) { /* Race with truncate? */ >> WARN_ON_ONCE(!PageUptodate(page)); >> >> - if (mapping_cap_account_dirty(mapping)) { >> - __inc_zone_page_state(page, NR_FILE_DIRTY); >> - __inc_bdi_stat(mapping->backing_dev_info, >> - BDI_RECLAIMABLE); >> - task_io_account_write(PAGE_CACHE_SIZE); >> - } >> + if (mapping_cap_account_dirty(mapping)) > > That 'if' is not necessary. account_page_dirtied() already has one. > The extra 'if' is not an optimization either, because the ceph fs is > not likely to have un-accountable mappings.
Sweet. Thanks.
quoted text
> >> + account_page_dirtied(page, page->mapping); >> radix_tree_tag_set(&mapping->page_tree, >> page_index(page), PAGECACHE_TAG_DIRTY); >> >> diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c >> index c920164..967ed7d 100644 >> --- a/fs/nilfs2/segment.c >> +++ b/fs/nilfs2/segment.c >> @@ -1599,7 +1599,7 @@ nilfs_copy_replace_page_buffers(struct page *page, struct list_head *out) >> kunmap_atomic(kaddr, KM_USER0); >> >> if (!TestSetPageWriteback(clone_page)) >> - inc_zone_page_state(clone_page, NR_WRITEBACK); >> + account_page_writeback(clone_page, page_mapping(clone_page)); >> unlock_page(clone_page); >> >> return 0; >> diff --git a/include/linux/mm.h b/include/linux/mm.h >> index a2b4804..b138392 100644 >> --- a/include/linux/mm.h >> +++ b/include/linux/mm.h >> @@ -855,6 +855,7 @@ int __set_page_dirty_no_writeback(struct page *page); >> int redirty_page_for_writepage(struct writeback_control *wbc, >> struct page *page); >> void account_page_dirtied(struct page *page, struct address_space *mapping); >> +void account_page_writeback(struct page *page, struct address_space *mapping); >> int set_page_dirty(struct page *page); >> int set_page_dirty_lock(struct page *page); >> int clear_page_dirty_for_io(struct page *page); >> diff --git a/mm/page-writeback.c b/mm/page-writeback.c >> index 37498ef..b8e7b3b 100644 >> --- a/mm/page-writeback.c >> +++ b/mm/page-writeback.c >> @@ -1096,6 +1096,21 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) >> task_io_account_write(PAGE_CACHE_SIZE); >> } >> } >> +EXPORT_SYMBOL(account_page_dirtied); >> + >> +/* >> + * Helper function for set_page_writeback family. >> + * NOTE: Unlike account_page_dirtied this does not rely on being atomic >> + * wrt interrupts. >> + */ >> + >> +void account_page_writeback(struct page *page, struct address_space *mapping) >> +{ >> + if (mapping_cap_account_dirty(mapping)) > > The 'if' test and *mapping parameter looks unnecessary at least for > now. The only place a mapping has BDI_CAP_NO_ACCT_WB but not > BDI_CAP_NO_WRITEBACK is fuse, which does its own accounting.
Cool. Thanks. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH 1/3] mm: helper functions for dirty and writeback a ...
, Michael Rubin
, (Thu Aug 19, 1:57 pm)
Re: [PATCH 1/3] mm: helper functions for dirty and writeba ...
, Wu Fengguang
, (Thu Aug 19, 7:34 pm)
Re: [PATCH 1/3] mm: helper functions for dirty and writeba ...
, Michael Rubin
, (Fri Aug 20, 1:19 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Rusty Russell
Re: 2.6.22-rc3-mm1
Bill Fink
Re: [PATCH] net: add ability to clear stats via ethtool - e1000/pcnet32
Jeffrey V. Merkey
Re: Versioning file system
Alexey Dobriyan
Re: [2.6.22.2 review 09/84] Fix rfkill IRQ flags.
Luben Tuikov
Re: Integration of SCST in the mainstream Linux kernel
git-commits-head
:
Linux Kernel Mailing List
V4L/DVB: tm6000: add special usb request to quit i2c tuner transfer
Linux Kernel Mailing List
OMAP: DSS2: SDI driver
Linux Kernel Mailing List
PCI: introduce pci_pcie_cap()
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
PCI hotplug: acpiphp: remove superfluous _HPP/_HPX evaluation
linux-netdev
:
David Miller
Re: [2.6.30-rc3] powerpc: compilation error of mace module
Rafael J. Wysocki
Re: [PATCH] igb: fix kexec with igb
Patrick McHardy
Re: [rfc 02/13] [RFC 02/13] netfilter: nf_conntrack_sip: Add callid parser
webmaster Maintenance
&#32852;&#31995;&#31995;&#32479;&#31649;&#29702;&#21592;
Krzysztof Oledzki
Re: Error: an inet prefix is expected rather than "0/0".
openbsd-misc
:
Ted Bullock
Re: Proliant DL380 G3 cannot get on network
Jack J. Woehr
Re: Real men don't attack straw men
Úlfar M. E. Johnson
installing openbsd in xen
Eric Furman
Re: Defending OpenBSD Performance
Tony Abernethy
Re: The Atheros story in much fewer words
git
:
Oliver Kullmann
Re: how to move with history?
Junio C Hamano
Re: [PATCH 2/3] git-add--interactive: remove hunk coalescing
Shawn O. Pearce
Re: Bugs in Gitosis
Alex Riesen
Re: git exclude patterns for directory
David Kastrup
Re: I'm a total push-over..
Colocation donated by:
Syndicate