Re: [RFC PATCH 0/4] kstrdup optimization

2015-01-08 Thread Andrzej Hajda
Hi Andi, Andreas, Thanks for comments. On 12/30/2014 10:29 PM, Andi Kleen wrote: >> This symmetry issue probably could be cleanly avoided only >> by having kfree() itself contain such an identifying check, as you suggest >> (thereby slowing down kfree() performance). > > It actually shouldn't sl

Re: [RFC PATCH 0/4] kstrdup optimization

2014-12-31 Thread Andrzej Hajda
On 12/29/2014 03:48 PM, Andrzej Hajda wrote: (...) > As I have tested it on mobile platform (exynos4210-trats) it saves above 2600 > string duplications. Below simple stats about the most frequent duplications: > Count String > 880 power > 874 subsystem > 130 device > 126 parameters >

Re: [RFC PATCH 0/4] kstrdup optimization

2014-12-30 Thread Andi Kleen
> This symmetry issue probably could be cleanly avoided only > by having kfree() itself contain such an identifying check, as you suggest > (thereby slowing down kfree() performance). It actually shouldn't slow it down. kfree already complains if you free a non slab page, this could be just in fro

Re: [RFC PATCH 0/4] kstrdup optimization

2014-12-30 Thread Andreas Mohr
Hi, Andrzej Hajda wrote: > On 12/30/2014 07:45 AM, Andi Kleen wrote: > > What happens if someone is to kfree() these strings? > > > > -Andi > > > kstrdup_const must be accompanied by kfree_const, I did not mention it > in cover letter > but it is described in the 1st patch commit message. > Simple

Re: [RFC PATCH 0/4] kstrdup optimization

2014-12-29 Thread Andrzej Hajda
On 12/30/2014 07:45 AM, Andi Kleen wrote: > Andrzej Hajda writes: > >> 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 >> t

Re: [RFC PATCH 0/4] kstrdup optimization

2014-12-29 Thread Andi Kleen
Andrzej Hajda writes: > 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