Messages in this thread | | | Date | Fri, 27 Oct 2006 12:05:54 +0400 | From | Vasily Averin <> | Subject | Re: [Q] missing unused dentry in prune_dcache()? |
| |
David Howells wrote: > Vasily Averin <vvs@sw.ru> wrote: > >> Therefore I've removed break of cycle and insert this dentry to head of the >> list. Theoretically it can lead to the second using of the same dentry, >> however I do not think that it is a big problem. > > Hmmm... Or maybe it could be a problem. If whenever we find the dentry we > stick it back on the head of the list, this could be a problem as we're > traversing the list from tail to head.
I still do not think that it could be a problem: count argument of prune_dcache is 128 if prune_dcache is called from shrink_dcache_memory() function and even lesser if prune_dcache is called from shrink_dcache_parent() function. I think usually the size of unused_dentry list (nr_usnused) is much greater and may be compared with these values only in case of very hard memory shortage. From my point of view it is very rare situation and I even not sure that it can really happen at all.
However even if this situation will happen I do not see here any seriously troubles: Yes, we will try to free the same dentries, much probably without success again, but why it is bad in case of hard memory shortage?
If my arguments are not convincing, I can protect second use of the same dentry: we can compare counter of the skipped dentries with nr_unused value.
And what the alternatives we have? 1) We can move this dentry to end of list? But it is bad because it will prevent shrink_dcache_memory(). 2) we can move these dentries into some temporal list, and insert it back to unused_list later? But it is bad because of we can be rescheduled and drop dcache_lock and may confuse someone who will assume that these dentries are in unused_list.
Therefore I believe that my patch is optimal solution.
Thank you, Vasily Averin - 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/
| |