sbitmap.c (c441bfb5f2866de71e092c1b9d866a65978dfe1a) sbitmap.c (9dbbc3b9d09d6deba9f3b9e1d5b355032ed46a75)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2016 Facebook
4 * Copyright (C) 2013-2014 Jens Axboe
5 */
6
7#include <linux/sched.h>
8#include <linux/random.h>

--- 569 unchanged lines hidden (view full) ---

578EXPORT_SYMBOL_GPL(sbitmap_queue_wake_up);
579
580void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
581 unsigned int cpu)
582{
583 /*
584 * Once the clear bit is set, the bit may be allocated out.
585 *
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2016 Facebook
4 * Copyright (C) 2013-2014 Jens Axboe
5 */
6
7#include <linux/sched.h>
8#include <linux/random.h>

--- 569 unchanged lines hidden (view full) ---

578EXPORT_SYMBOL_GPL(sbitmap_queue_wake_up);
579
580void sbitmap_queue_clear(struct sbitmap_queue *sbq, unsigned int nr,
581 unsigned int cpu)
582{
583 /*
584 * Once the clear bit is set, the bit may be allocated out.
585 *
586 * Orders READ/WRITE on the asssociated instance(such as request
586 * Orders READ/WRITE on the associated instance(such as request
587 * of blk_mq) by this bit for avoiding race with re-allocation,
588 * and its pair is the memory barrier implied in __sbitmap_get_word.
589 *
590 * One invariant is that the clear bit has to be zero when the bit
591 * is in use.
592 */
593 smp_mb__before_atomic();
594 sbitmap_deferred_clear_bit(&sbq->sb, nr);

--- 116 unchanged lines hidden ---
587 * of blk_mq) by this bit for avoiding race with re-allocation,
588 * and its pair is the memory barrier implied in __sbitmap_get_word.
589 *
590 * One invariant is that the clear bit has to be zero when the bit
591 * is in use.
592 */
593 smp_mb__before_atomic();
594 sbitmap_deferred_clear_bit(&sbq->sb, nr);

--- 116 unchanged lines hidden ---