diff options
| author | Mikulas Patocka <mpatocka@redhat.com> | 2018-03-15 17:22:00 -0400 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2018-04-03 15:04:25 -0400 |
| commit | 6b5e718cc138ef691e91685535e3ba776acc4893 (patch) | |
| tree | b4ce89d2c1d449814ee18ca21a5f358c9388822a /drivers/md | |
| parent | 21bb13276768da7925c0b532037e071877e4fb4d (diff) | |
dm bufio: relax alignment constraint on slab cache
The I/O buffer doesn't have to be aligned on block size granularity,
relax alignment to ARCH_KMALLOC_MINALIGN (required to allow DMA from
slab cache memory on some architectures).
Also, set SLAB_RECLAIM_ACCOUNT so that the memory allocated from the
cache is accounted as reclaimable and doesn't inflate the 'used' entry
in the free command.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
| -rw-r--r-- | drivers/md/dm-bufio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index ef6365ed2af0..c57aefb3c643 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
| @@ -618,7 +618,6 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t sector, | |||
| 618 | unsigned this_step = min((unsigned)(PAGE_SIZE - offset_in_page(ptr)), len); | 618 | unsigned this_step = min((unsigned)(PAGE_SIZE - offset_in_page(ptr)), len); |
| 619 | if (!bio_add_page(&b->bio, virt_to_page(ptr), this_step, | 619 | if (!bio_add_page(&b->bio, virt_to_page(ptr), this_step, |
| 620 | offset_in_page(ptr))) { | 620 | offset_in_page(ptr))) { |
| 621 | BUG_ON(b->c->block_size <= PAGE_SIZE); | ||
| 622 | use_dmio(b, rw, sector, n_sectors, offset, end_io); | 621 | use_dmio(b, rw, sector, n_sectors, offset, end_io); |
| 623 | return; | 622 | return; |
| 624 | } | 623 | } |
| @@ -1686,7 +1685,8 @@ struct dm_bufio_client *dm_bufio_client_create(struct block_device *bdev, unsign | |||
| 1686 | if (block_size < PAGE_SIZE) { | 1685 | if (block_size < PAGE_SIZE) { |
| 1687 | char name[26]; | 1686 | char name[26]; |
| 1688 | snprintf(name, sizeof name, "dm_bufio_cache-%u", c->block_size); | 1687 | snprintf(name, sizeof name, "dm_bufio_cache-%u", c->block_size); |
| 1689 | c->slab_cache = kmem_cache_create(name, c->block_size, c->block_size, 0, NULL); | 1688 | c->slab_cache = kmem_cache_create(name, c->block_size, ARCH_KMALLOC_MINALIGN, |
| 1689 | SLAB_RECLAIM_ACCOUNT, NULL); | ||
| 1690 | if (!c->slab_cache) { | 1690 | if (!c->slab_cache) { |
| 1691 | r = -ENOMEM; | 1691 | r = -ENOMEM; |
| 1692 | goto bad; | 1692 | goto bad; |
