From: Christoph Hellwig <hch@infradead.org>
To: Damien Le Moal <damien.lemoal@wdc.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v2 4/9] null_blk: improve zone locking
Date: Wed, 11 Nov 2020 08:11:47 +0000 [thread overview]
Message-ID: <20201111081147.GD23360@infradead.org> (raw)
In-Reply-To: <20201111051648.635300-5-damien.lemoal@wdc.com>
> + spin_lock_init(&dev->zone_res_lock);
> + if (dev->memory_backed)
> dev->zone_locks = bitmap_zalloc(dev->nr_zones, GFP_KERNEL);
> + else
> + dev->zone_locks = kmalloc_array(dev->nr_zones,
> + sizeof(spinlock_t), GFP_KERNEL);
> + if (!dev->zone_locks) {
Using the same pointer for different types is pretty horrible. At very
least we should use a union.
But I think we'd end up with less contention if we add a new
struct nullb_zone
that contains the fields of blk_zone that we actuall care about plus:
union {
spinlock_t spinlock;
mutex_t mutex;
}
and then use the proper lock primitive also for the memory backed case.
next prev parent reply other threads:[~2020-11-11 8:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 5:16 [PATCH v2 0/9] null_blk fixes, improvements and cleanup Damien Le Moal
2020-11-11 5:16 ` [PATCH v2 1/9] null_blk: Fix zone size initialization Damien Le Moal
2020-11-11 8:05 ` Christoph Hellwig
2020-11-11 8:06 ` Johannes Thumshirn
2020-11-11 5:16 ` [PATCH v2 2/9] null_blk: Fail zone append to conventional zones Damien Le Moal
2020-11-11 8:06 ` Christoph Hellwig
2020-11-11 8:07 ` Johannes Thumshirn
2020-11-11 5:16 ` [PATCH v2 3/9] null_blk: Align max_hw_sectors to blocksize Damien Le Moal
2020-11-11 8:06 ` Christoph Hellwig
2020-11-11 8:19 ` Damien Le Moal
2020-11-11 5:16 ` [PATCH v2 4/9] null_blk: improve zone locking Damien Le Moal
2020-11-11 8:11 ` Christoph Hellwig [this message]
2020-11-11 8:20 ` Damien Le Moal
2020-11-11 8:18 ` Johannes Thumshirn
2020-11-11 5:16 ` [PATCH v2 5/9] null_blk: Improve implicit zone close Damien Le Moal
2020-11-11 5:16 ` [PATCH v2 6/9] null_blk: cleanup discard handling Damien Le Moal
2020-11-11 8:13 ` Christoph Hellwig
2020-11-11 5:16 ` [PATCH v2 7/9] null_blk: discard zones on reset Damien Le Moal
2020-11-11 8:14 ` Christoph Hellwig
2020-11-11 8:19 ` Johannes Thumshirn
2020-11-11 5:16 ` [PATCH v2 8/9] null_blk: Allow controlling max_hw_sectors limit Damien Le Moal
2020-11-11 8:14 ` Christoph Hellwig
2020-11-11 8:22 ` Johannes Thumshirn
2020-11-11 8:23 ` Damien Le Moal
2020-11-11 5:16 ` [PATCH v2 9/9] null_blk: Move driver into its own directory Damien Le Moal
2020-11-11 7:52 ` Johannes Thumshirn
2020-11-11 6:04 ` [PATCH v2 0/9] null_blk fixes, improvements and cleanup Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201111081147.GD23360@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.