> kmem_cache_zalloc() without __GFP_NOFAIL may fail.
> btrfs use kmem_cache_zalloc() with GFP_NOFS mostly, 
> and only few place with __GFP_NOFAIL.
> xfs use kmem_cache_zalloc() with __GFP_NOFAIL mostly.
> It is very difficult to test all case of failure in kmem_cache_zalloc() .
> Should btrfs use kmem_cache_zalloc() with __GFP_NOFAIL just like xfs  
> or use mempool with pre-alloc to prevent fail?

I tried both way.

1) add __GFP_NOFAIL to kmem_cache_zalloc()
see 0001-btrfs-add-__GFP_NOFAIL-to-kmem_cache.patch

but this problem still happened in test.

2) switch to  use mempool_t for btrfs_path
see 0001-btrfs-switch-to-mempool_t-for-btrfs_path.patch

this problem yet not happen in test.

But the memory alloc failure is difficult to test, we need more review.

Best Regards
Wang Yugui (wangyu...@e16-tech.com)

Attachment: 0001-btrfs-add-__GFP_NOFAIL-to-kmem_cache.patch
Description: Binary data

Attachment: 0001-btrfs-switch-to-mempool_t-for-btrfs_path.patch
Description: Binary data

Reply via email to