From: Ryusuke Konishi <ryusuke-sG5X7nlA6pw@public.gmane.org>
To: users-JrjvKiOkagjYtjvyW6yDsg@public.gmane.org
Subject: Re: some notes on a memory leak
Date: Fri, 15 Feb 2008 15:07:09 +0900 (JST) [thread overview]
Message-ID: <20080215.150709.13051610.ryusuke@osrg.net> (raw)
In-Reply-To: <20080214010258.76494d68@vosztok>
From: Gergely Gábor <elentirmo.gilgalad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [NILFS users] some notes on a memory leak
Date: Thu, 14 Feb 2008 01:02:58 +0100
> Hello Ryusuke, and other nilfs developers, and users!
>
> I have left my computer working, testing nilfs. I have found that after
> a log period of time, most of the memory in the computer vas allocated as
> cache (according to vmstat) and even aftel killing all processes that held
> files open, the amount (~430 megabytes) did not decrease significantly.
> I have unmounted the filesystem, and most cache was freed up, and after
> remounting nilfs, the system was fast as lightning again (the module was not
> needed to be removed to reclaim the memory).
I'd like to append a note.
NILFS has two different things about the cache usage than ordinary
filesystems:
(1) Since the cleaner clowls over a partition, it adds new pages into a cache
of the block device one after another during it operates on the background.
(2) Some blocks, for example the blocks to store header information of each
segment, are allocated incrementally into the cache of the block device.
So, bursty writes or frequent sync writes may bloat it.
Conversely, the turnover of buffers for files or meta data should not be
higher than usual fs because a same buffer serves for a same file offset
even when its physical disk address changes.
I made a patch to minimize the bloat of bdev cache due to the second
difference.
If you are bothered with that, please test the following patch.
From my local tests, it didn't make no remarkable difference.
Best regards,
--
Ryusuke Konishi
NILFS team NTT
http://www.nilfs.org/
Index: fs/kern_feature.h
===================================================================
--- fs.orig/kern_feature.h 2008-02-14 15:28:15.000000000 +0900
+++ fs/kern_feature.h 2008-02-14 15:35:53.000000000 +0900
@@ -187,6 +187,13 @@
(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
#endif
/*
+ * invalidate_mapping_pages() got exported in linux-2.6.21.
+ */
+#ifndef HAVE_EXPORTED_INVALIDATE_MAPPING_PAGES
+# define HAVE_EXPORTED_INVALIDATE_MAPPING_PAGES \
+ (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20) || NILFS_BUILT_INTERNAL)
+#endif
+/*
* clear_page_dirty() and test_clear_page_dirty() were removed
* in linux-2.6.20
*/
Index: fs/segment.c
===================================================================
--- fs.orig/segment.c 2008-02-14 15:36:57.000000000 +0900
+++ fs/segment.c 2008-02-14 16:17:43.000000000 +0900
@@ -1615,11 +1615,19 @@
static int nilfs_segctor_terminate_segment(struct nilfs_sc_info *sci,
struct nilfs_segment_buffer *segbuf,
- struct inode *sufile)
+ struct the_nilfs *nilfs)
{
struct nilfs_segment_entry *ent = segbuf->sb_segent;
+ struct inode *sufile = nilfs->ns_sufile;
int err;
+#if HAVE_EXPORTED_INVALIDATE_MAPPING_PAGES
+ struct address_space *mapping = nilfs->ns_bdev->bd_inode->i_mapping;
+ int nshiftbits = PAGE_SHIFT - nilfs->ns_blocksize_bits;
+ pgoff_t start = segbuf->sb_fseg_start >> nshiftbits;
+ pgoff_t end = segbuf->sb_fseg_end >> nshiftbits;
+ invalidate_mapping_pages(mapping, start, end);
+#endif
err = nilfs_open_segment_entry(ent, sufile);
if (unlikely(err))
return err;
@@ -1669,7 +1677,7 @@
return err;
if (segbuf->sb_rest_blocks < NILFS_PSEG_MIN_BLOCKS) {
- err = nilfs_segctor_terminate_segment(sci, segbuf, sufile);
+ err = nilfs_segctor_terminate_segment(sci, segbuf, nilfs);
if (unlikely(err))
return err;
next prev parent reply other threads:[~2008-02-15 6:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-14 0:02 some notes on a memory leak Gergely Gábor
2008-02-15 3:18 ` Ryusuke Konishi
2008-02-15 6:07 ` Ryusuke Konishi [this message]
[not found] ` <20080215.150709.13051610.ryusuke-sG5X7nlA6pw@public.gmane.org>
2008-02-15 6:42 ` Ryusuke Konishi
2008-02-16 22:13 ` Gergely Gábor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080215.150709.13051610.ryusuke@osrg.net \
--to=ryusuke-sg5x7nla6pw@public.gmane.org \
--cc=users-JrjvKiOkagjYtjvyW6yDsg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.