Re: current pointer question/suggestion

Alexander Kjeldaas (astor@guardian.no)
Sun, 19 Jul 1998 23:19:48 +0200


On Sun, Jul 19, 1998 at 12:51:37AM -0600, Colin Plumb wrote:
>
> Changing memory mappings, while faster than file access, is
> expensive when compared to a simple system call like getpid().
> It's one of the biggest costs of task switching. It's Bad.
>

I guess it's hard avoiding a TLB flush on a task switch. However, on a
system call, I did hope to not have to invalidate more than _one_ TLB
entry, if any!

> However, one possibility is to have a per-processor page at
> a fixed kernel virtual address that can contain a pointer to the
> current task and any other desired per-processor information.
>

Your current will be as fast as accessing current->this with my
proposal (if it works).

your current = *(constant_address)
2.1 current = (%esp & ~8191)

The 2.1 current is a move and an and operation. The new current is a
memory load. It is not clear that there is any speed advantage by
using a load. However, if the task_struct of the current process is at
a constant address, there is no load, just a 'mov reg, constant'
operation, which is efficient (an unconfirmed rumor sais that the
K6-II doesn't even _use_ an execution unit for constant loads!).

astor

-- 
 Alexander Kjeldaas, Guardian Networks AS, Trondheim, Norway
 http://www.guardian.no/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html