hot take question for the day

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



so I was looking at the following code, from dynamic_debug.c,
I saw a minor code optimization, and wondered whether
its already optimized away by compiler.

Instead of actually testing it  ( I intend to eventually )
I figure Id ask if you all want to take an educated guess ?
or perhaps just do the test, and post results.

And since Im making a game of it, I might suggest a prize -
that by prepping a patch, showing its effect (none? tiny?
not observable in objdump?) and submitting it, I would ack it

I suspect that Greg might take it ; its a legit sub-optimality and
fix is at least decluttering and deobfuscating.

so heres the snippet.
if you got this far, you can find the prob (or 2)




static char *dynamic_emit_prefix(struct _ddebug *dp, char *buf)
{
int pos_after_tid;
int pos = 0;

*buf = '\0';

if (dp->flags & _DPRINTK_FLAGS_INCL_TID) {
if (in_interrupt())
pos += snprintf(buf + pos, remaining(pos), "<intr> ");
else
pos += snprintf(buf + pos, remaining(pos), "[%d] ",
task_pid_vnr(current));
}

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux