zfs arc_reclaim_thread: no need to call arc_reclaim_needed when

resetting needfree

needfree is checked at the very start of arc_reclaim_needed.
This change makes code easier to follow and maintain in face of
potential changed in arc_reclaim_needed.

Also, put the whole sub-block under _KERNEL because needfree can be set
only in kernel code.

To do: rename needfree to something else to aovid confusion with
OpenSolaris global variable of the same name which is used in the same
code, but has different meaning (page deficit).

Note: I have an impression that locking around accesses to this variable
as well as mutual notifications between arc_reclaim_thread and
arc_lowmem are not proper.

MFC after:	1 week
This commit is contained in:
avg 2010-08-24 17:48:22 +00:00
parent 8bd4a7f02f
commit e53e842194

View File

@ -2317,12 +2317,12 @@ arc_reclaim_thread(void *dummy __unused)
if (arc_eviction_list != NULL)
arc_do_user_evicts();
if (arc_reclaim_needed()) {
needfree = 0;
#ifdef _KERNEL
if (needfree) {
needfree = 0;
wakeup(&needfree);
#endif
}
#endif
/* block until needed, or one second, whichever is shorter */
CALLB_CPR_SAFE_BEGIN(&cpr);