Messages in this thread |  | | Date | Thu, 13 Mar 2003 06:19:26 -0500 | From | Jakub Jelinek <> | Subject | Why is get_current() not const function? |
| |
Hi!
E.g. on x86-64, NEW_AUX_ENT(AT_UID, (elf_addr_t) current->uid); NEW_AUX_ENT(AT_EUID, (elf_addr_t) current->euid); NEW_AUX_ENT(AT_GID, (elf_addr_t) current->gid); NEW_AUX_ENT(AT_EGID, (elf_addr_t) current->egid); results in 4 movq %gs:0,%rax instructions while one is completely enough. Anyone remembers why get_current function (on arches which define current to get_current()) is not const and why on x86-64 the movq %%gs:0, %0 inline asm is volatile with "memory" clobber? AFAIK current ought to be constant in any function with the exception of schedule. If the reason is kernel/sched.c, then IMHO it is certainly worth making get_current const everywhere but in kernel/sched.c (e.g. through special define in sched.c before any includes).
Jakub - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |