Re: [PATCH v2 03/11] tty: kbd: reduce stack size with KASAN
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: 2017-06-14 22:16:50
Also in:
lkml
Arnd Bergmann, on mer. 14 juin 2017 23:56:39 +0200, wrote:
quoted
I however agree that it's a bad idea to inline it in functions where it's called so many times (and we're talking about the keyboard anyway).quoted
-static void puts_queue(struct vc_data *vc, char *cp) +static noinline_if_stackbloat void puts_queue(struct vc_data *vc, char *cp)I don't see why, it's only called once in the callers. k_fn, however, is called several times in k_pad, so that could be why, but then it's rather be the inlining of k_fn which is a bad idea.It's called by applkey, which in turn is called by k_pad(),
k_pad calls applkey twice only. Is that really to be considered bloat?
quoted
quoted
-static void fn_send_intr(struct vc_data *vc) +static noinline_if_stackbloat void fn_send_intr(struct vc_data *vc)This one is only referenced, not called, I don't see how that could pose problem.I was surprised by this as well, but it seems that gcc these days is smart enough to turn the indirect function calls for k_handler[type] and/or f_handler[value] into inlines again when it has already determined the index to be constant.
Cool :) But I don't see how it can see find it out constant. The only fn_handler[] caller is k_spec, using value as index. The only caller of f_handler[] is kbd_keycode, using type as index, and keysym&0xff as value. That is definitely not constant :) And it's only one caller, I don't see how that can bloat. Samuel