LCOV - code coverage report
Current view: top level - lib - nodemask.c (source / functions) Hit Total Coverage
Test: landlock.info Lines: 5 11 45.5 %
Date: 2021-04-22 12:43:58 Functions: 1 2 50.0 %

          Line data    Source code
       1             : // SPDX-License-Identifier: GPL-2.0
       2             : #include <linux/nodemask.h>
       3             : #include <linux/module.h>
       4             : #include <linux/random.h>
       5             : 
       6        7186 : int __next_node_in(int node, const nodemask_t *srcp)
       7             : {
       8        7186 :         int ret = __next_node(node, srcp);
       9             : 
      10        7186 :         if (ret == MAX_NUMNODES)
      11        7186 :                 ret = __first_node(srcp);
      12        7186 :         return ret;
      13             : }
      14             : EXPORT_SYMBOL(__next_node_in);
      15             : 
      16             : #ifdef CONFIG_NUMA
      17             : /*
      18             :  * Return the bit number of a random bit set in the nodemask.
      19             :  * (returns NUMA_NO_NODE if nodemask is empty)
      20             :  */
      21           0 : int node_random(const nodemask_t *maskp)
      22             : {
      23           0 :         int w, bit = NUMA_NO_NODE;
      24             : 
      25           0 :         w = nodes_weight(*maskp);
      26           0 :         if (w)
      27           0 :                 bit = bitmap_ord_to_pos(maskp->bits,
      28             :                         get_random_int() % w, MAX_NUMNODES);
      29           0 :         return bit;
      30             : }
      31             : #endif

Generated by: LCOV version 1.14