LCOV - code coverage report
Current view: top level - fs/xfs - kmem.c (source / functions) Hit Total Coverage
Test: fstests of 6.5.0-rc4-xfsx @ Mon Jul 31 20:08:34 PDT 2023 Lines: 9 12 75.0 %
Date: 2023-07-31 20:08:34 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : /*
       3             :  * Copyright (c) 2000-2005 Silicon Graphics, Inc.
       4             :  * All Rights Reserved.
       5             :  */
       6             : #include "xfs.h"
       7             : #include "xfs_message.h"
       8             : #include "xfs_trace.h"
       9             : 
      10             : void *
      11  3046454501 : kmem_alloc(size_t size, xfs_km_flags_t flags)
      12             : {
      13  3046454501 :         int     retries = 0;
      14  3046454501 :         gfp_t   lflags = kmem_flags_convert(flags);
      15  3045912045 :         void    *ptr;
      16             : 
      17  3045912045 :         trace_kmem_alloc(size, flags, _RET_IP_);
      18             : 
      19  3046044566 :         do {
      20  3046044566 :                 ptr = kmalloc(size, lflags);
      21  3047100577 :                 if (ptr || (flags & KM_MAYFAIL))
      22  3047100577 :                         return ptr;
      23           0 :                 if (!(++retries % 100))
      24           0 :                         xfs_err(NULL,
      25             :         "%s(%u) possible memory allocation deadlock size %u in %s (mode:0x%x)",
      26             :                                 current->comm, current->pid,
      27             :                                 (unsigned int)size, __func__, lflags);
      28           0 :                 memalloc_retry_wait(lflags);
      29             :         } while (1);
      30             : }

Generated by: LCOV version 1.14