From: Jens Axboe <jens.axboe@oracle.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC PATCH] discarding swap
Date: Thu, 11 Sep 2008 10:58:16 +0200 [thread overview]
Message-ID: <20080911085816.GP20055@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.64.0809102015230.16131@blonde.site>
On Wed, Sep 10 2008, Hugh Dickins wrote:
> On Wed, 10 Sep 2008, Jens Axboe wrote:
> > On Tue, Sep 09 2008, Hugh Dickins wrote:
> >
> > > It seems odd to me that the data-less blkdev_issue_discard() is limited
> > > at all by max_hw_sectors; but I'm guessing there's a good reason, safety
> > > perhaps, which has forced you to that.
> >
> > The discard request needs to be turned into a hw command at some point,
> > and for that we still need to fit the offset and size in there. So we
> > are still limited by 32MB commands on sata w/lba48, even though we are
> > not moving any data. Suboptimal, but...
>
> ... makes good sense, thanks.
>
> > > Here's the proposed patch, or combination of patches: the blkdev and
> > > swap parts should certainly be separated. Advice welcome - thanks!
> >
> > I'll snatch up the blk bits and put them in for-2.6.28. OK if I add your
> > SOB to that?
>
> That would be great. Thanks a lot for all your comments, I'd been
> expecting a much rougher ride! If you've not already put it in,
> here's that subset of the patch - change it around as you wish.
>
>
> [PATCH] block: adjust blkdev_issue_discard for swap
>
> Three mods to blkdev_issue_discard(), thinking ahead to its use on swap:
>
> 1. Add gfp_mask argument, so swap allocation can use it where GFP_KERNEL
> might deadlock but GFP_NOIO is safe.
>
> 2. Enlarge nr_sects argument from unsigned to sector_t: unsigned long is
> enough to cover a whole swap area, but sector_t suits any partition.
>
> 3. Add an occasional cond_resched() into the loop, to avoid risking bad
> latencies when discarding a large area in small max_hw_sectors steps.
>
> Change sb_issue_discard()'s nr_blocks to sector_t too; but no need seen
> for a gfp_mask there, just pass GFP_KERNEL down to blkdev_issue_discard().
>
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
Hugh, I applied this - but on 2nd though, I killed the cond_resched()
for two reasons:
- We should only add stuff like that if it's known problematic
- We'll be throttling on the request allocation eventually, once we get
128 of these in flight.
So if this turns out to be a problem, we can revisit the cond_resched()
solution.
--
Jens Axboe
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <jens.axboe@oracle.com>
To: Hugh Dickins <hugh@veritas.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC PATCH] discarding swap
Date: Thu, 11 Sep 2008 10:58:16 +0200 [thread overview]
Message-ID: <20080911085816.GP20055@kernel.dk> (raw)
In-Reply-To: <Pine.LNX.4.64.0809102015230.16131@blonde.site>
On Wed, Sep 10 2008, Hugh Dickins wrote:
> On Wed, 10 Sep 2008, Jens Axboe wrote:
> > On Tue, Sep 09 2008, Hugh Dickins wrote:
> >
> > > It seems odd to me that the data-less blkdev_issue_discard() is limited
> > > at all by max_hw_sectors; but I'm guessing there's a good reason, safety
> > > perhaps, which has forced you to that.
> >
> > The discard request needs to be turned into a hw command at some point,
> > and for that we still need to fit the offset and size in there. So we
> > are still limited by 32MB commands on sata w/lba48, even though we are
> > not moving any data. Suboptimal, but...
>
> ... makes good sense, thanks.
>
> > > Here's the proposed patch, or combination of patches: the blkdev and
> > > swap parts should certainly be separated. Advice welcome - thanks!
> >
> > I'll snatch up the blk bits and put them in for-2.6.28. OK if I add your
> > SOB to that?
>
> That would be great. Thanks a lot for all your comments, I'd been
> expecting a much rougher ride! If you've not already put it in,
> here's that subset of the patch - change it around as you wish.
>
>
> [PATCH] block: adjust blkdev_issue_discard for swap
>
> Three mods to blkdev_issue_discard(), thinking ahead to its use on swap:
>
> 1. Add gfp_mask argument, so swap allocation can use it where GFP_KERNEL
> might deadlock but GFP_NOIO is safe.
>
> 2. Enlarge nr_sects argument from unsigned to sector_t: unsigned long is
> enough to cover a whole swap area, but sector_t suits any partition.
>
> 3. Add an occasional cond_resched() into the loop, to avoid risking bad
> latencies when discarding a large area in small max_hw_sectors steps.
>
> Change sb_issue_discard()'s nr_blocks to sector_t too; but no need seen
> for a gfp_mask there, just pass GFP_KERNEL down to blkdev_issue_discard().
>
> Signed-off-by: Hugh Dickins <hugh@veritas.com>
Hugh, I applied this - but on 2nd though, I killed the cond_resched()
for two reasons:
- We should only add stuff like that if it's known problematic
- We'll be throttling on the request allocation eventually, once we get
128 of these in flight.
So if this turns out to be a problem, we can revisit the cond_resched()
solution.
--
Jens Axboe
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-09-11 8:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-09 21:28 [RFC PATCH] discarding swap Hugh Dickins
2008-09-09 21:28 ` Hugh Dickins
2008-09-10 17:35 ` Jens Axboe
2008-09-10 17:35 ` Jens Axboe
2008-09-10 19:51 ` Hugh Dickins
2008-09-10 19:51 ` Hugh Dickins
2008-09-10 21:28 ` David Woodhouse
2008-09-10 21:28 ` David Woodhouse
2008-09-12 12:10 ` Hugh Dickins
2008-09-12 14:09 ` David Woodhouse
2008-09-12 14:09 ` David Woodhouse
2008-09-12 15:52 ` Hugh Dickins
2008-09-12 15:52 ` Hugh Dickins
2008-09-12 16:22 ` David Woodhouse
2008-09-12 16:22 ` David Woodhouse
2008-09-12 17:46 ` Hugh Dickins
2008-09-12 17:46 ` Hugh Dickins
2008-09-12 16:50 ` Jamie Lokier
2008-09-12 16:50 ` Jamie Lokier
2008-09-12 17:25 ` Hugh Dickins
2008-09-12 17:25 ` Hugh Dickins
2008-09-11 8:58 ` Jens Axboe [this message]
2008-09-11 8:58 ` Jens Axboe
2008-09-11 10:47 ` Hugh Dickins
2008-09-11 10:47 ` Hugh Dickins
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=20080911085816.GP20055@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=dwmw2@infradead.org \
--cc=hugh@veritas.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.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.