Re: [PATCH 2/3] user.c: use kmem_cache_zalloc()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: Alexey Dobriyan <adobriyan@...>, <linux-kernel@...>, <devel@...>
Date: Saturday, September 22, 2007 - 12:33 am

On Fri, 21 Sep 2007, Andrew Morton wrote:

Agreed, and this (implementing atomic ops using spinlocks) is already true
for the CRIS platform.

However, cris' implementation explicitly takes care to ensure that
atomic_t contains just a solitary int member, and no spinlock_t's
inside the atomic_t itself. [ include/asm-cris/arch-v32/atomic.h ]

Of course, that "128" limits scalability, so no more than 128 CPUs can be
executing atomic ops at any given instant of time, but admittedly I'm
getting anal here myself ... (but probably that's often perfectly the
right attitude to have too)



Hmm, it's borderline.

Such changes make text smaller (in terms of LOC as well vmlinux size).

But they also hurt grepping. Often we (at least I) want to grep for when
is a variable/struct member/etc getting initialized or getting
set/assigned to. Take this case, for example -- I bet it's important (for
overall logic) that those variables get initialized to zero. But *zalloc()
functions do that implicitly, so it wastes precious seconds or minutes of
developer time when grepping that code.

OTOH, we could make it standard practise to put a little comment on top
of such *zalloc() usages, explicitly enumerating the struct members that
that the *zalloc() is assumed to initialize to zero.

<runs away>


Satyam
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/3] user.c: use kmem_cache_zalloc(), Alexey Dobriyan, (Fri Sep 21, 5:39 am)
Re: [PATCH 2/3] user.c: use kmem_cache_zalloc(), Andrew Morton, (Fri Sep 21, 3:34 pm)
Re: [PATCH 2/3] user.c: use kmem_cache_zalloc(), Satyam Sharma, (Sat Sep 22, 12:33 am)