[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb8f7127-edff-4a32-2d5c-4343002bda19@acm.org>
Date: Thu, 15 Apr 2021 12:18:52 -0700
From: Bart Van Assche <bvanassche@....org>
To: Changheun Lee <nanich.lee@...sung.com>
Cc: Johannes.Thumshirn@....com, asml.silence@...il.com,
axboe@...nel.dk, damien.lemoal@....com, gregkh@...uxfoundation.org,
hch@...radead.org, jisoo2146.oh@...sung.com,
junho89.kim@...sung.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, ming.lei@...hat.com,
mj0123.lee@...sung.com, osandov@...com, patchwork-bot@...nel.org,
seunghwan.hyun@...sung.com, sookwan7.kim@...sung.com,
tj@...nel.org, tom.leiming@...il.com, woosung2.lee@...sung.com,
yt0928.kim@...sung.com
Subject: Re: [PATCH v7 1/3] bio: limit bio max size
On 4/15/21 3:38 AM, Changheun Lee wrote:
> @@ -167,6 +168,7 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
> max_sectors = round_down(max_sectors,
> limits->logical_block_size >> SECTOR_SHIFT);
> limits->max_sectors = max_sectors;
> + limits->bio_max_bytes = max_sectors << SECTOR_SHIFT;
>
> q->backing_dev_info->io_pages = max_sectors >> (PAGE_SHIFT - 9);
> }
Can the new shift operation overflow? If so, how about using
check_shl_overflow()?
> @@ -538,6 +540,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
> {
> unsigned int top, bottom, alignment, ret = 0;
>
> + t->bio_max_bytes = min_not_zero(t->bio_max_bytes, b->bio_max_bytes);
> +
> t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
> t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors);
> t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors);
The above will limit bio_max_bytes for all stacked block devices, which
is something we do not want. I propose to set t->bio_max_bytes to
UINT_MAX in blk_stack_limits() and to let the stacked driver (e.g.
dm-crypt) decide whether or not to lower that value.
> diff --git a/include/linux/bio.h b/include/linux/bio.h
> index d0246c92a6e8..e5add63da3af 100644
> --- a/include/linux/bio.h
> +++ b/include/linux/bio.h
> @@ -106,6 +106,8 @@ static inline void *bio_data(struct bio *bio)
> return NULL;
> }
>
> +extern unsigned int bio_max_size(struct bio *bio);
You may want to define bio_max_size() as an inline function in bio.h
such that no additional function calls are introduced in the hot path.
Thanks,
Bart.
Powered by blists - more mailing lists