Re: explicit dcache <-> user-space cache coherency, sys_mark_dir_clean(), O_CLEAN
From: Ingo Molnar
Date: Fri Feb 20 2004 - 12:06:01 EST
* Linus Torvalds <torvalds@xxxxxxxx> wrote:
> Your version is also not multi-threaded: you can never allow more than
> one thread doing the "sys_mark_dir_clean()". That was the reason for
> having two bits: so that anybody can do a lookup in parallell, and
> only the "filldir" part needs to be serialized.
>
> So I do believe you'd want two bits anyway.
hm, right. So for the lookup to be lockless, it would have to be managed
via a syscall variant similar in mechanism to the two-bit approach you
suggested:
ret = sys_manage_dir_cache(fd, op);
where the following cache states are defined:
(invalid, refill_in_progress, valid)
the following type of cache ops are defined:
(lookup, cache_filled)
the semantics of the sys_manage_dir_cache() syscall are the following:
- op is 'lookup': the syscall returns 'valid' if state is valid. If the
state is 'refill_in_progress' then lookup returns refill_in_progress.
If the state is 'invalid', then the state goes to 'refill_in_progress'
and 'invalid' is returned.
- op is 'cache_filled': the syscall moves the state to 'valid' if state
is still 'refill_in_progress'. It goes to 'refill_in_progress' if the
state was 'invalid'.
the kernel does the valid->invalid and refill_in_progress->invalid
transitions automatically, when relevant VFS events occur. All dentries
start out in state invalid.
there's another class of problems: is it an issue that directory renames
that move this directory (higher up in the directory hierarchy of this
directory) do not invalidate the cache? In that case there's no dnotify
event either.
Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/