Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-19797

kfilnd use mempool for allocation inside kfilnd

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • Lustre 2.18.0
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      This change optimizes kfilnd transaction and message buffer
      allocation to eliminate OOM-related sleeping, prevent filesystem
      recursion deadlocks, and improve performance under memory
      pressure.

      Changed GFP_KERNEL to GFP_NOFS in critical allocation paths to prevent
      filesystem recursion. The GFP_KERNEL flag can trigger memory reclaim
      that calls into filesystem code, creating a deadlock when the
      filesystem is waiting on network operations that are themselves trying
      to allocate memory. The affected functions include
      kfilnd_tn_alloc_common(), kfilnd_tn_set_sgl_buf(), kfilnd_peer_get(),
      and kfilnd_ep_get_key().

      Added mempool infrastructure to provide guaranteed allocation under
      memory pressure. Two mempools are created: one for transaction objects
      and one for immediate message buffers. Reserve sizes are calculated
      dynamically based on peer_credits, number of CPTs, and a safety factor
      of 2:
      reserve = peer_credits * num_cpts * 2

      The reserve sizes can be tuned via module parameters tn_reserve_min
      and msg_reserve_min (default -1 enables auto-sizing). Mempool
      statistics are exposed via debugfs
      at /sys/kernel/debug/kfilnd/mempool_stats showing min_reserve,
      curr_avail, and elements_allocated.

      A kfilnd_tn_get_mempool_stats() accessor function was added to safely
      expose mempool statistics to debugfs without breaking module
      encapsulation.

      Attachments

        Activity

          People

            hornc Chris Horn
            hornc Chris Horn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: