kernel/entry: Remove some redundancy checks on syscall works
Quoted 8 lines · Khalid Ali
Quoted 1 line
There is a redundant checks of thread syscall work.
Not really.
Quoted 1 line
After we read thread syscall work we are checking the work bits using
We are doing nothing. Please write your changelogs in imperative mood and do not try to impersonate code.
Sorry, i guess my english sucks.
Quoted 30 lines
Quoted 7 lines
SYSCALL_WORK_ENTERandSYSCALL_WORK_EXITon syscall entry and exit respectively, and at the same timesyscall_trace_enter()andsyscall_exit_work()checking bits one by one, the bits we already checked. This is redundancy. So either we need to check the work bits one by one as I did, or check as whole. On my prespective, i think the way code is implemented now checking work bits one by one is simpler and gives us more granular control.That's just wrong and absolutely not redundant. Care to look at the definition of
SYSCALL_WORK_ENTER:#define SYSCALL_WORK_ENTER (SYSCALL_WORK_SECCOMP | \ SYSCALL_WORK_SYSCALL_TRACEPOINT | \ SYSCALL_WORK_SYSCALL_TRACE | \ SYSCALL_WORK_SYSCALL_EMU | \ SYSCALL_WORK_SYSCALL_AUDIT | \ SYSCALL_WORK_SYSCALL_USER_DISPATCH | \ ARCH_SYSCALL_WORK_ENTER)So this initial check avoids:
1) Doing an unconditional out of line call
2) Checking bit for bit to figure out that there is none set.
Same applies for
SYSCALL_WORK_EXIT.Your change neither makes anything simpler nor provides more granular control.
Quoted 8 lines
All it does is adding overhead and therefore guaranteed to introduce a performance regression.
Not going to happen.
Thanks,
tglx
Thanks, for the response and noted all your points, however i spotted some minor details also:
First if we are talking about performance then we may need likely() on SYSCALL_WORK_ENTER since the probability of condition evaluating as true is very high.
Second syscall_enter_audit() missing SYSCALL_WORK_SYSCALL_AUDIT evaluation, aren't we supposed to call
it only if SYSCALL_WORK_SYSCALL_AUDIT is set?
Should i create another patch fixing these two points, of course if i am right?
Thanks, Khalid Ali
Can you please reply to the mail you received, so that there are proper In-Reply-To and References tags in the mail, which are required for mail threading?
I almost missed your replies because they ended up as single mail threads without reference somewhere in my endless mail pile.
Quoted 3 lines · Khalid Ali
First if we are talking about performance then we may need
likely()onSYSCALL_WORK_ENTERsince the probability of condition evaluating as true is very high.
That depends on the system configuration scenario and the likely() has been omitted on purpose.
Quoted 3 lines
Second
syscall_enter_audit()missingSYSCALL_WORK_SYSCALL_AUDITevaluation, aren't we supposed to call it only ifSYSCALL_WORK_SYSCALL_AUDITis set?
That's redundant as syscall_enter_audit() checks for a valid audit context already. Both are valid indicators and go in lockstep. So it might be arguable that evaluating the work bit is cheaper than the context check, but I doubt it's measurable.
Thanks,
tglx
Re: [PATCH] include/linux: Fix outdated comment on entry-common.h
Quoted 4 lines
That's redundant as
syscall_enter_audit()checks for a valid audit context already. Both are valid indicators and go in lockstep. So it might be arguable that evaluating the work bit is cheaper than the context check, but I doubt it's measurable.
This will also increase readability and make things more consistent. So i think we should use SYSCALL_WORK_SYSCALL_AUDIT bit to check if we need to do auditing, instead of checking audit context, on both entry and exit.
So should i do with another patch, what i am verifying is if we really agree with one point.
Thanks
Khalid Ali
Re: [PATCH] kernel/entry: Remove some redundancy checks on syscall
In reply to Thomas GleixnerSince there were no much objection here i think we agreed with that, so i sent v2 for this one. Could you please redirect our conversasion there. This patch was wrong so i took your last suggestion and improved it.
Thanks for your patience,
Khalid Ali