RE: How can TUX user module get notified when a page is removed from cache?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2 Apr 2002, Liang Yang wrote:

> Here is the idea of our work. We need to query the caching status of
> files and notify the front end(a proxy) dynamically, so the proxy know
> in which backend server the user requested file is still cached and the
> proxy will only forward the user request to that machine which still
> keep the file in cache. If both the backend machines still cache the
> file, the proxy will select one randomly.  To simplify our model, now we
> don't need such kind of callback functions to be notified by Linux
> kernel which files is discarded, we will issue our request to query the
> file caching status in our user-space module.

ok, this scheme makes sense.

> We have some questions:
> 
> First, if we call path_walk with atomic-lookup bit set and it returns a
> dentry, we know this file is 'cached'. But you say a file may be
> partially cached, so does path_walk still return a dentry when a file is
> partially cached.

yes. I'd suggest the following solution: extend the TUX module API with a
new call like TUX_ACTION_OBJECT_CACHED. This will be a transparent method
to tell whether the file is cached by this particular node or not.

on the kernel side i'd suggest for you to do an atomic lookup, and if it
succeeds, look up the first page of the file, by doing an atomic
(nonblocking) 1-byte do_generic_file_read. This is atomic and has low
overhead.

for 99% of the cases if the first byte of the file is cached then the
whole file is cached. You can still extend this mechanizm to look at
intermediate pages as well, if it becomes a practical issue anytime in the
future, your userspace module will not be affected by this.

[feel free to send me an email if you have trouble implementing this.]

> Second, can we use path_walk directly in our user-space modules and how
> to use it in user-space modules?

i'd suggest to provide the above TUX action, because this is a
functionality that is not sufficiently represented in the current Linux
API. So while it might be possible to look a file name up atomically from
userspace, it's not possible to do the 'is the first byte of the file
cached or not' kind of queries currently.

	Ingo





[Index of Archives]     [Apache Users]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Packaging]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Docs]