Re: [PATCH 1/1] ipc/mqueue.c: Drag unneeded code out of locks

From: Manfred Spraul
Date: Mon Nov 17 2014 - 14:09:05 EST


Hi Steven,

On 11/16/2014 08:40 PM, Steven Stewart-Gallus wrote:
Finally, please don't ignore the rest of my message. Even if my patch
isn't that good there are lots of ways to compromise and improve it
such as adding tests, annotations and making it clearer.

I think you were already given ideas how to improve the patch:

a) split the patch.

b) create test cases so that you are able to check that the code still behaves as it did before
Did you test the change to mqueue_create()?

c) Give each a good summary of what you want to achieve:
- readability
- coding style
- performance
- avoid a lock entirely, switch to RCU instead of spin_lock(), ...
- reduce the time a lock is held (usually only useful if the reduction is significant - both relative and absolute).
- ...

Writing that down also helps you:
There were multiple patches that I've dropped myself - simply because I have noticed that the patch doesn't achieve anything useful.

From your changes: The one to mqueue_read_file might make sense, it avoids to hold the spinlock over the snprintf.
For the other changes, I don't see that they improve something, but perhaps I have overlooked something.

Best regards,
Manfred


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