* [PATCH] Don't allow memory reclaim to wait on the filesystem in inode writeback @ 2008-05-01 12:26 David Chinner 2008-05-01 13:15 ` Christoph Hellwig 0 siblings, 1 reply; 4+ messages in thread From: David Chinner @ 2008-05-01 12:26 UTC (permalink / raw) To: xfs-dev; +Cc: xfs-oss Don't allow memory reclaim to wait on the filesystem in inode writeback If we allow memory reclaim to wait on the pages under writeback in inode cluster writeback we could deadlock because we are currently holding the ILOCK on the initial writeback inode which is needed in data I/O completion to change the file size or do unwritten extent conversion before the pages are taken out of writeback state. Signed-off-by: Dave Chinner <dgc@sgi.com> --- fs/xfs/xfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c =================================================================== --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c 2008-04-28 16:35:23.000000000 +1000 +++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c 2008-05-01 20:04:55.151880341 +1000 @@ -2986,7 +2986,7 @@ xfs_iflush_cluster( ASSERT(pag->pag_ici_init); ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *); - ilist = kmem_alloc(ilist_size, KM_MAYFAIL); + ilist = kmem_alloc(ilist_size, KM_NOFS); if (!ilist) return 0; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Don't allow memory reclaim to wait on the filesystem in inode writeback 2008-05-01 12:26 [PATCH] Don't allow memory reclaim to wait on the filesystem in inode writeback David Chinner @ 2008-05-01 13:15 ` Christoph Hellwig 2008-05-01 22:08 ` David Chinner 0 siblings, 1 reply; 4+ messages in thread From: Christoph Hellwig @ 2008-05-01 13:15 UTC (permalink / raw) To: David Chinner; +Cc: xfs-dev, xfs-oss On Thu, May 01, 2008 at 10:26:11PM +1000, David Chinner wrote: > Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c > =================================================================== > --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c 2008-04-28 16:35:23.000000000 +1000 > +++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c 2008-05-01 20:04:55.151880341 +1000 > @@ -2986,7 +2986,7 @@ xfs_iflush_cluster( > ASSERT(pag->pag_ici_init); > > ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *); > - ilist = kmem_alloc(ilist_size, KM_MAYFAIL); > + ilist = kmem_alloc(ilist_size, KM_NOFS); > if (!ilist) > return 0; This should be KM_MAYFAIL | KM_NOFS, because KM_NOFS doesn't imply that the allocation may fail. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Don't allow memory reclaim to wait on the filesystem in inode writeback 2008-05-01 13:15 ` Christoph Hellwig @ 2008-05-01 22:08 ` David Chinner 2008-05-01 22:10 ` Christoph Hellwig 0 siblings, 1 reply; 4+ messages in thread From: David Chinner @ 2008-05-01 22:08 UTC (permalink / raw) To: Christoph Hellwig; +Cc: David Chinner, xfs-dev, xfs-oss On Thu, May 01, 2008 at 09:15:21AM -0400, Christoph Hellwig wrote: > On Thu, May 01, 2008 at 10:26:11PM +1000, David Chinner wrote: > > Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c > > =================================================================== > > --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c 2008-04-28 16:35:23.000000000 +1000 > > +++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c 2008-05-01 20:04:55.151880341 +1000 > > @@ -2986,7 +2986,7 @@ xfs_iflush_cluster( > > ASSERT(pag->pag_ici_init); > > > > ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *); > > - ilist = kmem_alloc(ilist_size, KM_MAYFAIL); > > + ilist = kmem_alloc(ilist_size, KM_NOFS); > > if (!ilist) > > return 0; > > This should be KM_MAYFAIL | KM_NOFS, because KM_NOFS doesn't imply that > the allocation may fail. Yes, right you are - I only looked at the effect of __GFP_FS, not what kmem_alloc does. i.e. kmem_flags_convert() doesn't do anything with KM_MAYFAIL, forgetting that it's kmem_alloc() that uses it... New patch below. Cheers, Dave. -- Dave Chinner Principal Engineer SGI Australian Software Group --- Don't allow memory reclaim to wait on the filesystem in inode writeback If we allow memory reclaim to wait on the pages under writeback in inode cluster writeback we could deadlock because we are currently holding the ILOCK on the initial writeback inode which is needed in data I/O completion to change the file size or do unwritten extent conversion before the pages are taken out of writeback state. Signed-off-by: Dave Chinner <dgc@sgi.com> --- fs/xfs/xfs_inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c =================================================================== --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c 2008-04-28 16:35:23.000000000 +1000 +++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c 2008-05-02 08:03:30.071824780 +1000 @@ -2986,7 +2986,7 @@ xfs_iflush_cluster( ASSERT(pag->pag_ici_init); ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *); - ilist = kmem_alloc(ilist_size, KM_MAYFAIL); + ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS); if (!ilist) return 0; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Don't allow memory reclaim to wait on the filesystem in inode writeback 2008-05-01 22:08 ` David Chinner @ 2008-05-01 22:10 ` Christoph Hellwig 0 siblings, 0 replies; 4+ messages in thread From: Christoph Hellwig @ 2008-05-01 22:10 UTC (permalink / raw) To: David Chinner; +Cc: Christoph Hellwig, xfs-dev, xfs-oss On Fri, May 02, 2008 at 08:08:25AM +1000, David Chinner wrote: > Index: 2.6.x-xfs-new/fs/xfs/xfs_inode.c > =================================================================== > --- 2.6.x-xfs-new.orig/fs/xfs/xfs_inode.c 2008-04-28 16:35:23.000000000 +1000 > +++ 2.6.x-xfs-new/fs/xfs/xfs_inode.c 2008-05-02 08:03:30.071824780 +1000 > @@ -2986,7 +2986,7 @@ xfs_iflush_cluster( > ASSERT(pag->pag_ici_init); > > ilist_size = XFS_INODE_CLUSTER_SIZE(mp) * sizeof(xfs_inode_t *); > - ilist = kmem_alloc(ilist_size, KM_MAYFAIL); > + ilist = kmem_alloc(ilist_size, KM_MAYFAIL|KM_NOFS); > if (!ilist) > return 0; Looks good. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-05-01 22:09 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-01 12:26 [PATCH] Don't allow memory reclaim to wait on the filesystem in inode writeback David Chinner 2008-05-01 13:15 ` Christoph Hellwig 2008-05-01 22:08 ` David Chinner 2008-05-01 22:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox