Re: [PATCH v2] kernel/rcutorture.c: be sure of enough memory forresult printing

From: Chen Gang
Date: Thu Nov 07 2013 - 19:56:39 EST


On 11/08/2013 04:59 AM, Paul E. McKenney wrote:
> On Thu, Nov 07, 2013 at 10:30:25AM +0800, Chen Gang wrote:
>> > If the contents is more than 4096 bytes (e.g. if have 1K cpus), current
>> > sprintf() will cause memory overflow. And this fix patch is to be sure
>> > of memory large enough.
>> >
>> > Benefit:
>> >
>> > - do not truncate printing contents.
>> > - extensible, it is large enough for printing various related contents.
>> > - simple and clear enough for both source code readers and writers.
>> >
>> > Shortcoming:
>> >
>> > - It will waste some memory:
>> >
>> > 1 cpu now comsumes 50 - 60 bytes, and this patch provides 200 bytes.
>> > global printing now comsumes a few KB, and this patch provide 8KB,
>> > so for 1K cpus, it may waste 100 - 200 KB memory.
>> >
>> > after finish printing, it will free the related memory, quickly.
>> > it is a test module, so wast a little memory for extensible is OK.
>> >
>> > Related test (Fedora16 2 CPUs, 2GB RAM x86_64)
>> >
>> > - as module, with/without "torture_type=srcu".
>> > - build-in not boot runnable, with/without "torture_type=srcu".
>> > - build-in let boot runnable, with/without "torture_type=srcu".
>> >
>> >
>> > Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
> Thank you, queued for 3.14.

Thank you too.

--
Chen Gang
--
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/