Re: [PATCH 0/5] kstrdup optimization

2015-01-14 Thread Tejun Heo
On Tue, Jan 13, 2015 at 03:37:31PM -0800, Andrew Morton wrote: > What the heck does (the cheerily undocumented) KERNFS_STATIC_NAME do > and can we remove it if this patchset is in place? The same thing, in a narrower scope. It's currently used to avoid making copies of sysfs file names which are

Re: [PATCH 0/5] kstrdup optimization

2015-01-14 Thread Andrzej Hajda
On 01/14/2015 12:37 AM, Andrew Morton wrote: > On Mon, 12 Jan 2015 10:18:38 +0100 Andrzej Hajda wrote: > >> Hi, >> >> kstrdup if often used to duplicate strings where neither source neither >> destination will be ever modified. In such case we can just reuse the source >> instead of duplicating

Re: [PATCH 0/5] kstrdup optimization

2015-01-14 Thread Andrzej Hajda
On 01/14/2015 12:37 AM, Andrew Morton wrote: On Mon, 12 Jan 2015 10:18:38 +0100 Andrzej Hajda a.ha...@samsung.com wrote: Hi, kstrdup if often used to duplicate strings where neither source neither destination will be ever modified. In such case we can just reuse the source instead of

Re: [PATCH 0/5] kstrdup optimization

2015-01-14 Thread Tejun Heo
On Tue, Jan 13, 2015 at 03:37:31PM -0800, Andrew Morton wrote: What the heck does (the cheerily undocumented) KERNFS_STATIC_NAME do and can we remove it if this patchset is in place? The same thing, in a narrower scope. It's currently used to avoid making copies of sysfs file names which are

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Andrew Morton
On Tue, 13 Jan 2015 16:10:57 -0800 Craig Milo Rogers wrote: > > As kfree_const() has the exact same signature as kfree(), the risk of > > accidentally passing pointers returned from kstrdup_const() to kfree() seems > > high, which may lead to memory corruption if the pointer doesn't point to > >

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Craig Milo Rogers
> As kfree_const() has the exact same signature as kfree(), the risk of > accidentally passing pointers returned from kstrdup_const() to kfree() seems > high, which may lead to memory corruption if the pointer doesn't point to > allocated memory. ... >> To verify if the source is in .rodata

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Andrew Morton
On Mon, 12 Jan 2015 21:45:58 +0100 Geert Uytterhoeven wrote: > On Mon, Jan 12, 2015 at 10:18 AM, Andrzej Hajda wrote: > > kstrdup if often used to duplicate strings where neither source neither > > destination will be ever modified. In such case we can just reuse the source > > instead of

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Andrew Morton
On Mon, 12 Jan 2015 10:18:38 +0100 Andrzej Hajda wrote: > Hi, > > kstrdup if often used to duplicate strings where neither source neither > destination will be ever modified. In such case we can just reuse the source > instead of duplicating it. The problem is that we must be sure that > the

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Andrew Morton
On Mon, 12 Jan 2015 10:18:38 +0100 Andrzej Hajda a.ha...@samsung.com wrote: Hi, kstrdup if often used to duplicate strings where neither source neither destination will be ever modified. In such case we can just reuse the source instead of duplicating it. The problem is that we must be sure

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Andrew Morton
On Mon, 12 Jan 2015 21:45:58 +0100 Geert Uytterhoeven ge...@linux-m68k.org wrote: On Mon, Jan 12, 2015 at 10:18 AM, Andrzej Hajda a.ha...@samsung.com wrote: kstrdup if often used to duplicate strings where neither source neither destination will be ever modified. In such case we can just

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Craig Milo Rogers
As kfree_const() has the exact same signature as kfree(), the risk of accidentally passing pointers returned from kstrdup_const() to kfree() seems high, which may lead to memory corruption if the pointer doesn't point to allocated memory. ... To verify if the source is in .rodata function

Re: [PATCH 0/5] kstrdup optimization

2015-01-13 Thread Andrew Morton
On Tue, 13 Jan 2015 16:10:57 -0800 Craig Milo Rogers rog...@isi.edu wrote: As kfree_const() has the exact same signature as kfree(), the risk of accidentally passing pointers returned from kstrdup_const() to kfree() seems high, which may lead to memory corruption if the pointer doesn't

Re: [PATCH 0/5] kstrdup optimization

2015-01-12 Thread Geert Uytterhoeven
On Mon, Jan 12, 2015 at 10:18 AM, Andrzej Hajda wrote: > kstrdup if often used to duplicate strings where neither source neither > destination will be ever modified. In such case we can just reuse the source > instead of duplicating it. The problem is that we must be sure that > the source is

[PATCH 0/5] kstrdup optimization

2015-01-12 Thread Andrzej Hajda
Hi, kstrdup if often used to duplicate strings where neither source neither destination will be ever modified. In such case we can just reuse the source instead of duplicating it. The problem is that we must be sure that the source is non-modifiable and its life-time is long enough. I suspect

[PATCH 0/5] kstrdup optimization

2015-01-12 Thread Andrzej Hajda
Hi, kstrdup if often used to duplicate strings where neither source neither destination will be ever modified. In such case we can just reuse the source instead of duplicating it. The problem is that we must be sure that the source is non-modifiable and its life-time is long enough. I suspect

Re: [PATCH 0/5] kstrdup optimization

2015-01-12 Thread Geert Uytterhoeven
On Mon, Jan 12, 2015 at 10:18 AM, Andrzej Hajda a.ha...@samsung.com wrote: kstrdup if often used to duplicate strings where neither source neither destination will be ever modified. In such case we can just reuse the source instead of duplicating it. The problem is that we must be sure that