[Dev] tizen-common kernel xattr memory leak

Janusz Kozerski j.kozerski at samsung.com
Thu Oct 9 09:57:05 GMT 2014


On 2014-10-09 11:42:56, José Bollo wrote:
> Hi Janusz,
> 
> On gio, 2014-10-09 at 11:20 +0200, Janusz Kozerski wrote:
> > Hi Stephane,
> >
> > I have a question about tizen-commom kernel. I think there is some 
> > issue in this kernel. It looks like the kernel have a memory leak 
> > while
> writing to the xattrs.
> > Could you check it?
> >
> > I've wrote a simple bash script-test. This command will add a random 
> > text value to a "user.test" xattr for every file on a filesystem 
> > (these xattrs shoudn't break anything):
> > ---
> > find / \( -fstype rootfs -o -fstype ext4 \) -exec setfattr -n
> > user.test1 -v $(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 228 
> > | head -n 1) '{}' \;
> > 2>/dev/null
> > ---
> 
> I've just tried to do the same but I replaced setfattr with cat
> > /dev/null
> 
> And I also see on my image that the used memory raise from 442kB to 1265kB.
> 
> I'm guessing that the leak is coming from the file caching of the kernel.
> 
> In man 5 proc, I found that "echo 1 > /proc/sys/vm/drop_caches" reverts.
> Can you try?

I've tried - it's exactly like you said.
Using cat gives even more leakage, and "echo 1 > /proc/sys/vm/drop_caches" helps.

Do you know how to fix it?

BR,
Janusz

> 
> Best regards
> José
> 
> 
> > Run in one console a 'top' command, look at the amount of free 
> > memory (keep this 'top' process alive). In other console run the 
> > script, and go back to the first console and look at the memory 
> > counter. On my machine after running this script there is about 
> > 100MB taken by the kernel (the "find" process itself takes no more 
> > then a few MB). And even if the "find...' command is done the memory isn't freed.
> >
> > What is intreresting: no mather how many times I will run the commad 
> > - the memory leak occurs only once.
> > We're trying to find the cause in kernel source.
> >
> > (+ Tizen dev list)
> >
> > BR,
> > Janusz Kozerski
> >
> > _______________________________________________
> > Dev mailing list
> > Dev at lists.tizen.org
> > https://lists.tizen.org/listinfo/dev




More information about the Dev mailing list