Re: [PATCH 5/6] coredump: kill call_count, add core_name_size

From: Andrew Morton
Date: Fri May 24 2013 - 15:53:28 EST


On Wed, 15 May 2013 22:12:32 +0200 Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> Imho, "atomic_t call_count" is ugly and should die. It buys
> nothing and in fact it can grow more than necessary, expand
> doesn't check if it was already incremented by another task.
>
> Kill it, and introduce "static int core_name_size" updated by
> expand_corename(). This is obviously racy too but harmless,
> and core_name_size never grows for no reason.
>
> We do not bother to to calculate the "right" new size, we
> simply do kmalloc(size_we_need) and use ksize() to rely on
> kmalloc_index's decision.
>
> Finally change format_corename() to use expand_corename(),
> krealloc(NULL) is fine.

The code still looks like a bunch of fluff. I look at it and think
"wtf, why doesn't it just use kasprintf()".

If there were any comments in there at all which explained the reason
for the code's existence, perhaps I wouldn't think that. But there
aren't, so I do.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/