diff options
author | Chunwei Chen <[email protected]> | 2016-10-28 13:37:00 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-11-07 11:04:44 -0800 |
commit | 8e71ab99dc4a591d41ab0d9255ddca3e914f47e4 (patch) | |
tree | a76b7f97cf6d18501094e37626fad5b235b44415 /include/linux | |
parent | 83bf769d500a231eac023c9f9f88719ad205694e (diff) |
Batch free zpl_posix_acl_release
Currently every calls to zpl_posix_acl_release will schedule a delayed task,
and each delayed task will add a timer. This used to be fine except for
possibly bad performance impact.
However, in Linux 4.8, a new timer wheel implementation[1] is introduced. In
this new implementation, the larger the delay, the less accuracy the timer is.
So when we have a flood of timer from zpl_posix_acl_release, they will expire
at the same time. Couple with the fact that task_expire will do linear search
with lock held. This causes an extreme amount of contention inside interrupt
and would actually lockup the system.
We fix this by doing batch free to prevent a flood of delayed task. Every call
to zpl_posix_acl_release will put the posix_acl to be freed on a lockless
list. Every batch window, 1 sec, the zpl_posix_acl_free will fire up and free
every posix_acl that passed the grace period on the list. This way, we only
have one delayed task every second.
[1] https://lwn.net/Articles/646950/
Signed-off-by: Chunwei Chen <[email protected]>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/vfs_compat.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h index 989c237a3..6ed5075a3 100644 --- a/include/linux/vfs_compat.h +++ b/include/linux/vfs_compat.h @@ -212,10 +212,7 @@ lseek_execute( #else -static inline void -zpl_posix_acl_free(void *arg) { - kfree(arg); -} +void zpl_posix_acl_release_impl(struct posix_acl *); static inline void zpl_posix_acl_release(struct posix_acl *acl) @@ -223,10 +220,8 @@ zpl_posix_acl_release(struct posix_acl *acl) if ((acl == NULL) || (acl == ACL_NOT_CACHED)) return; - if (atomic_dec_and_test(&acl->a_refcount)) { - taskq_dispatch_delay(system_taskq, zpl_posix_acl_free, acl, - TQ_SLEEP, ddi_get_lbolt() + 60*HZ); - } + if (atomic_dec_and_test(&acl->a_refcount)) + zpl_posix_acl_release_impl(acl); } static inline void |