xfs: properly account for reclaimed inodes
PATCH 1/1 xfs: properly account for reclaimed inodes
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
--- fs/xfs/linux-2.6/xfs_sync.c | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-)
fs/xfs/linux-2.6/xfs_sync.c +14 -5
@@ -668,14 +668,11 @@ xfs_inode_set_reclaim_tag(xfs_perag_put (pag); } -void -__xfs_inode_clear_reclaim_tag ( -xfs_mount_t *mp, +STATIC void +__xfs_inode_clear_reclaim (xfs_perag_t *pag,xfs_inode_t *ip) { -radix_tree_tag_clear (&pag->pag_ici_root, -XFS_INO_TO_AGINO (mp, ip->i_ino),XFS_ICI_RECLAIM_TAG ); pag->pag_ici_reclaimable--;if (!pag->pag_ici_reclaimable) {/* clear the reclaim tag from the perag radix tree */
@@ -689,6 +686,17 @@ __xfs_inode_clear_reclaim_tag( } } +void +__xfs_inode_clear_reclaim_tag ( +xfs_mount_t *mp, +xfs_perag_t *pag, +xfs_inode_t *ip) +{ +radix_tree_tag_clear (&pag->pag_ici_root, +XFS_INO_TO_AGINO (mp, ip->i_ino),XFS_ICI_RECLAIM_TAG ); +__xfs_inode_clear_reclaim (pag, ip); +} +/* * Inodes in different states need to be treated differently, and the return * value of xfs_iflush is not sufficient to get this right. The following table
@@ -838,6 +846,7 @@ reclaim:if (!radix_tree_delete (&pag->pag_ici_root,XFS_INO_TO_AGINO (ip->i_mount, ip->i_ino)))ASSERT (0 ); +__xfs_inode_clear_reclaim (pag, ip);write_unlock (&pag->pag_ici_lock);/*
Signature · 6 lines
1.7.2.3 _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>
Looks OK to me, and has run through a few hours of testing without problems.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>
Yes, this looks right to me. The state was correctly adjusted in xfs_iget_cache_hit() when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 30 lines · Alex Elder
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>
Quoted 6 lines
Yes, this looks right to me. The state was correctly adjusted in
xfs_iget_cache_hit()when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.Reviewed-by Alex Elder <[email protected]>
Alex, can you push this to Linus ASAP? This needs to go back to stable kernels as well..
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Hi,
Quoted 36 lines · Dave Chinner
Quoted 35 lines · Alex Elder
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>Yes, this looks right to me. The state was correctly adjusted in
xfs_iget_cache_hit()when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.
Quoted 4 lines
Quoted 1 line
Reviewed-by Alex Elder <[email protected]>Alex, can you push this to Linus ASAP? This needs to go back to stable kernels as well..
Here is my suggestion of a backport to .34. Dave, Alex, do you approve?
Hannes
fs/xfs/xfs_iget.c +1 -0
@@ -499,6 +499,7 @@ xfs_ireclaim(write_lock (&pag->pag_ici_lock);if (!radix_tree_delete (&pag->pag_ici_root, agino))ASSERT (0 ); + pag->pag_ici_reclaimable--;write_unlock (&pag->pag_ici_lock);xfs_perag_put (pag);
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 55 lines · On Monday 04 October 2010, 12:22:13 Johannes Weiner wrote:
Hi,
Quoted 36 lines · Dave Chinner
Quoted 35 lines · Alex Elder
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>Yes, this looks right to me. The state was correctly adjusted in
xfs_iget_cache_hit()when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.Quoted 4 lines
Quoted 1 line
Reviewed-by Alex Elder <[email protected]>Alex, can you push this to Linus ASAP? This needs to go back to stable kernels as well..
Here is my suggestion of a backport to .34. Dave, Alex, do you approve?
Hannes
fs/xfs/xfs_iget.c +0
-0
fs/xfs/xfs_iget.c xfs_ireclaim( · line 505
Quoted 7 lines
fs/xfs/xfs_iget.c +1
-0@@ -499,6 +499,7 @@ xfs_ireclaim(write_lock (&pag->pag_ici_lock);if (!radix_tree_delete (&pag->pag_ici_root, agino))ASSERT (0 ); + pag->pag_ici_reclaimable--;write_unlock (&pag->pag_ici_lock);xfs_perag_put (pag);
Ping?
Masters of xfs, please raise your voices!
Pete
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Alex Elder
Reviewed-byQuoted 66 lines · Hans-Peter Jansen
Quoted 55 lines · On Monday 04 October 2010, 12:22:13 Johannes Weiner wrote:
Hi,
Quoted 36 lines · Dave Chinner
Quoted 35 lines · Alex Elder
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>Yes, this looks right to me. The state was correctly adjusted in
xfs_iget_cache_hit()when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.Quoted 4 lines
Quoted 1 line
Reviewed-by Alex Elder <[email protected]>Alex, can you push this to Linus ASAP? This needs to go back to stable kernels as well..
Here is my suggestion of a backport to .34. Dave, Alex, do you approve?
Hannes
fs/xfs/xfs_iget.c +0
-0fs/xfs/xfs_iget.c xfs_ireclaim( · line 505
Quoted 7 lines
fs/xfs/xfs_iget.c +1
-0@@ -499,6 +499,7 @@ xfs_ireclaim(write_lock (&pag->pag_ici_lock);if (!radix_tree_delete (&pag->pag_ici_root, agino))ASSERT (0 ); + pag->pag_ici_reclaimable--;write_unlock (&pag->pag_ici_lock);xfs_perag_put (pag);Ping?
Quoted 3 lines
Masters of xfs, please raise your voices!
Pete
I know I'm a little late to the game in saying so, but I do agree this looks like the right fix for the .34 stable branch.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Dave Chinner
Reviewed-byQuoted 54 lines · Johannes Weiner
Hi,
Quoted 36 lines · Dave Chinner
Quoted 35 lines · Alex Elder
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>Yes, this looks right to me. The state was correctly adjusted in
xfs_iget_cache_hit()when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.Quoted 4 lines
Quoted 1 line
Reviewed-by Alex Elder <[email protected]>Alex, can you push this to Linus ASAP? This needs to go back to stable kernels as well..
Here is my suggestion of a backport to .34. Dave, Alex, do you approve?
Hannes
fs/xfs/xfs_iget.c +0
-0
fs/xfs/xfs_iget.c xfs_ireclaim( · line 504
Quoted 6 lines
fs/xfs/xfs_iget.c +1
-0@@ -499,6 +499,7 @@ xfs_ireclaim(write_lock (&pag->pag_ici_lock);if (!radix_tree_delete (&pag->pag_ici_root, agino))ASSERT (0 ); + pag->pag_ici_reclaimable--;write_unlock (&pag->pag_ici_lock);xfs_perag_put (pag);
Looks good to me.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
J.H.
Tested-byQuoted 64 lines · Dave Chinner
Quoted 54 lines · Johannes Weiner
Hi,
Quoted 36 lines · Dave Chinner
Quoted 35 lines · Alex Elder
Quoted 23 lines · Johannes Weiner
When marking an inode reclaimable, a per-AG counter is increased, the inode is tagged reclaimable in its per-AG tree, and, when this is the first reclaimable inode in the AG, the AG entry in the per-mount tree is also tagged.
When an inode is finally reclaimed, however, it is only deleted from the per-AG tree. Neither the counter is decreased, nor is the parent tree's AG entry untagged properly.
Since the tags in the per-mount tree are not cleared, the inode shrinker iterates over all AGs that have had reclaimable inodes at one point in time.
The counters on the other hand signal an increasing amount of slab objects to reclaim. Since "70e60ce xfs: convert inode shrinker to per-filesystem context" this is not a real issue anymore because the shrinker bails out after one iteration.
But the problem was observable on a machine running v2.6.34, where the reclaimable work increased and each process going into direct reclaim eventually got stuck on the xfs inode shrinking path, trying to scan several million objects.
Quoted 5 lines
Fix this by properly unwinding the reclaimable-state tracking of an inode when it is reclaimed.
Signed-off-by Johannes Weiner <[email protected]>Yes, this looks right to me. The state was correctly adjusted in
xfs_iget_cache_hit()when a RECLAIMABLE inode is found in the cache, but it was not done when reclaim completes.Quoted 4 lines
Quoted 1 line
Reviewed-by Alex Elder <[email protected]>Alex, can you push this to Linus ASAP? This needs to go back to stable kernels as well..
Here is my suggestion of a backport to .34. Dave, Alex, do you approve?
Hannes
fs/xfs/xfs_iget.c +0
-0fs/xfs/xfs_iget.c xfs_ireclaim( · line 504
Quoted 6 lines
fs/xfs/xfs_iget.c +1
-0@@ -499,6 +499,7 @@ xfs_ireclaim(write_lock (&pag->pag_ici_lock);if (!radix_tree_delete (&pag->pag_ici_root, agino))ASSERT (0 ); + pag->pag_ici_reclaimable--;write_unlock (&pag->pag_ici_lock);xfs_perag_put (pag);Looks good to me.
Quoted 1 line
Reviewed-by Dave Chinner <[email protected]>
i've got this in production and things seem to be acting a lot more like I would expect.
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs