https://github.com/torvalds/linux
Revision c20037652700024cffeb6b0f74306ce9b391248f authored by Linus Torvalds on 07 March 2020, 20:20:29 UTC, committed by Linus Torvalds on 07 March 2020, 20:20:29 UTC
Pull io_uring fixes from Jens Axboe:
 "Here are a few io_uring fixes that should go into this release. This
  contains:

   - Removal of (now) unused io_wq_flush() and associated flag (Pavel)

   - Fix cancelation lockup with linked timeouts (Pavel)

   - Fix for potential use-after-free when freeing percpu ref for fixed
     file sets

   - io-wq cancelation fixups (Pavel)"

* tag 'io_uring-5.6-2020-03-07' of git://git.kernel.dk/linux-block:
  io_uring: fix lockup with timeouts
  io_uring: free fixed_file_data after RCU grace period
  io-wq: remove io_wq_flush and IO_WQ_WORK_INTERNAL
  io-wq: fix IO_WQ_WORK_NO_CANCEL cancellation
2 parent s 5dfcc13 + f0e20b8
Raw File
Tip revision: c20037652700024cffeb6b0f74306ce9b391248f authored by Linus Torvalds on 07 March 2020, 20:20:29 UTC
Merge tag 'io_uring-5.6-2020-03-07' of git://git.kernel.dk/linux-block
Tip revision: c200376
nodemask.c
// SPDX-License-Identifier: GPL-2.0
#include <linux/nodemask.h>
#include <linux/module.h>
#include <linux/random.h>

int __next_node_in(int node, const nodemask_t *srcp)
{
	int ret = __next_node(node, srcp);

	if (ret == MAX_NUMNODES)
		ret = __first_node(srcp);
	return ret;
}
EXPORT_SYMBOL(__next_node_in);

#ifdef CONFIG_NUMA
/*
 * Return the bit number of a random bit set in the nodemask.
 * (returns NUMA_NO_NODE if nodemask is empty)
 */
int node_random(const nodemask_t *maskp)
{
	int w, bit = NUMA_NO_NODE;

	w = nodes_weight(*maskp);
	if (w)
		bit = bitmap_ord_to_pos(maskp->bits,
			get_random_int() % w, MAX_NUMNODES);
	return bit;
}
#endif
back to top