public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: Greg KH <gregkh@suse.de>,
	stable@kernel.org, Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>,
	maneesh@linux.vnet.ibm.com,
	Srivatsa Vaddagiri <vatsa@linux.vnet.ibm.com>,
	Balbir Singh <balbir@in.ibm.com>, Gautham Shenoy <ego@in.ibm.com>
Subject: Re: 2.6.22-stable causes oomkiller to be invoked
Date: Fri, 14 Dec 2007 23:41:03 +0900	[thread overview]
Message-ID: <476295FF.1040202@gmail.com> (raw)
In-Reply-To: <20071213175423.GA2977@linux.vnet.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]

Dhaval Giani wrote:
> On Thu, Dec 13, 2007 at 10:16:58PM +0530, Dhaval Giani wrote:
>> On Thu, Dec 13, 2007 at 08:29:36AM -0800, Greg KH wrote:
>>> On Thu, Dec 13, 2007 at 08:48:47PM +0530, Dhaval Giani wrote:
>>>> On Thu, Dec 13, 2007 at 06:53:26PM +0530, Dhaval Giani wrote:
>>>>> On Thu, Dec 13, 2007 at 06:03:33PM +0530, Dhaval Giani wrote:
>>>>>> Hi Greg, Tejun,
>>>>>>
>>>>>> The following script causes oomkiller to be invoked on my system here.
>>>>>>
>>>>>> while echo; do cat /sys/kernel/kexec_crash_loaded; done
>>>>>>
>>>>>  while echo; do cat /sys/kernel/uevent_seqnum ; done;
>>>>>
>>>>> causes oomkiller to be invoked on 2.6.22-stable, 2.6.23-stable and
>>>>> 2.6.24-rc5 as well. It seems not be particularly related to any single
>>>>> file in sysfs.
>>>>>
>>>> And on 2.6.24-rc5-mm1 as well.
>>> How long do you have to run this?  I'm not seeing a problem here with
>>> 2.6.24-rc5 using SLUB, but I might not have run things long enough.
>>>
>> I hit it reliably under 10 mins. I've seen it with both SLUB and SLAB.
>>
>>> I ran slabinfo and don't see anything leaking either, do you?
>> Nor could I find anything, at least nothing directly apparent. (But, I
>> am not very good at ready slabinfo yet.)
>>
>> I've attached the .config if that helps in reproducing it. (Am testing
>> with SLUB again on latest -mm).
>>
> 
> OK, so it ooms there as well. I am attaching its config and part of the
> dmesg (whatever I could capture).

I can't reproduce it here either.  Please apply the attached patch and
reproduce the problem.  It will report the number of allocated buffer
pages every 10 sec.  After oom occurs, please report how this number
changed and the result of 'cat /proc/slabinfo'.

Thanks.

-- 
tejun

[-- Attachment #2: sysfs-leak-debug.patch --]
[-- Type: text/x-patch, Size: 1635 bytes --]

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 4045bdc..6e7fa62 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -17,9 +17,30 @@
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <asm/uaccess.h>
+#include <linux/jiffies.h>
+#include <asm/atomic.h>
 
 #include "sysfs.h"
 
+static unsigned long last_jiffies = INITIAL_JIFFIES;
+static atomic_t sysfs_page_cnt = ATOMIC_INIT(0);
+
+static void sysfs_page_inc(void)
+{
+	atomic_inc(&sysfs_page_cnt);
+
+	if (time_before(jiffies, last_jiffies + 10 * HZ))
+		return;
+
+	last_jiffies = jiffies;
+	printk("XXX sysfs_page_cnt=%d\n", atomic_read(&sysfs_page_cnt));
+}
+
+static void sysfs_page_dec(void)
+{
+	atomic_dec(&sysfs_page_cnt);
+}
+
 #define to_sattr(a) container_of(a,struct subsys_attribute, attr)
 
 /*
@@ -105,8 +126,10 @@ static int fill_read_buffer(struct dentry * dentry, struct sysfs_buffer * buffer
 	int ret = 0;
 	ssize_t count;
 
-	if (!buffer->page)
+	if (!buffer->page) {
 		buffer->page = (char *) get_zeroed_page(GFP_KERNEL);
+		sysfs_page_inc();
+	}
 	if (!buffer->page)
 		return -ENOMEM;
 
@@ -188,8 +211,10 @@ fill_write_buffer(struct sysfs_buffer * buffer, const char __user * buf, size_t
 {
 	int error;
 
-	if (!buffer->page)
+	if (!buffer->page) {
 		buffer->page = (char *)get_zeroed_page(GFP_KERNEL);
+		sysfs_page_inc();
+	}
 	if (!buffer->page)
 		return -ENOMEM;
 
@@ -434,8 +459,10 @@ static int sysfs_release(struct inode *inode, struct file *filp)
 
 	sysfs_put_open_dirent(sd, buffer);
 
-	if (buffer->page)
+	if (buffer->page) {
 		free_page((unsigned long)buffer->page);
+		sysfs_page_dec();
+	}
 	kfree(buffer);
 
 	return 0;

  reply	other threads:[~2007-12-14 14:41 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 12:33 2.6.22-stable causes oomkiller to be invoked Dhaval Giani
2007-12-13 13:23 ` Dhaval Giani
2007-12-13 15:18   ` Dhaval Giani
2007-12-13 16:29     ` Greg KH
2007-12-13 16:46       ` Dhaval Giani
2007-12-13 17:54         ` Dhaval Giani
2007-12-14 14:41           ` Tejun Heo [this message]
2007-12-14 15:47             ` Dhaval Giani
2007-12-14 15:54               ` Tejun Heo
2007-12-14 16:16                 ` Dhaval Giani
2007-12-14 17:50                   ` Andrew Morton
2007-12-14 18:28                     ` Dhaval Giani
2007-12-14 23:05                       ` Andrew Morton
2007-12-15  3:52                         ` Dhaval Giani
2007-12-15  6:00                           ` Andrew Morton
2007-12-15 10:44                             ` Dhaval Giani
     [not found]                               ` <20071217045904.GB31386@linux.vnet.ibm.com>
     [not found]                                 ` <Pine.LNX.4.64.0712171143280.12871@schroedinger.engr.sgi.com>
     [not found]                                   ` <20071217120720.e078194b.akpm@linux-foundation.org>
     [not found]                                     ` <Pine.LNX.4.64.0712171222470.29500@schroedinger.engr.sgi.com>
2007-12-21  4:45                                       ` Dhaval Giani
2007-12-26 21:01                                         ` Christoph Lameter
2007-12-28 10:11                                           ` Dhaval Giani
2008-01-02 20:45                                             ` Christoph Lameter
2008-01-02 21:54                                               ` Christoph Lameter
2008-01-03  3:59                                                 ` Dhaval Giani
2008-01-03  4:16                                                   ` Dhaval Giani
2008-01-03 21:04                                                     ` Christoph Lameter
2008-01-07 20:04                                                       ` Christoph Lameter
2008-01-08  4:33                                                         ` Dhaval Giani
2007-12-30 14:01                                           ` Ingo Molnar
2007-12-30 19:24                                             ` Dhaval Giani
2008-01-02 20:48                                             ` Christoph Lameter

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=476295FF.1040202@gmail.com \
    --to=htejun@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@in.ibm.com \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=ego@in.ibm.com \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@linux.vnet.ibm.com \
    --cc=stable@kernel.org \
    --cc=vatsa@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox