From: Andrew Morton <akpm@osdl.org>
To: Alex Tomas <alex@clusterfs.com>
Cc: linux-ext4@vger.kernel.org, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] ext4-block-reservation.patch
Date: Sat, 23 Dec 2006 14:40:59 -0800 [thread overview]
Message-ID: <20061223144059.f515a3a3.akpm@osdl.org> (raw)
In-Reply-To: <m3y7ozvftf.fsf@bzzz.home.net>
On Fri, 22 Dec 2006 23:25:16 +0300
Alex Tomas <alex@clusterfs.com> wrote:
Once this code is settled in we should consider removal of the existing
reservations code from ext4.
> +
> +struct ext4_reservation_slot {
> + __u64 rs_reserved;
> + spinlock_t rs_lock;
> +} ____cacheline_aligned;
Should be ____cacheline_aligned_in_smp.
That's assuming it needs to be cacheline aligned at all. It can consume a
lot of space.
<looks>
oh, this should be allocated with alloc_percpu(), in which case the
open-coded alignment can perhaps go away.
> +
> +int ext4_reserve_local(struct super_block *sb, int blocks)
> +{
> + struct ext4_sb_info *sbi = EXT4_SB(sb);
> + struct ext4_reservation_slot *rs;
> + int rc = -ENOSPC;
> +
> + preempt_disable();
> + rs = sbi->s_reservation_slots + smp_processor_id();
use get_cpu() here.
> +void ext4_rebalance_reservation(struct ext4_reservation_slot *rs, __u64 free)
> +{
> + int i, used_slots = 0;
> + __u64 chunk;
> +
> + /* let's know what slots have been used */
> + for (i = 0; i < NR_CPUS; i++)
> + if (rs[i].rs_reserved || i == smp_processor_id())
> + used_slots++;
> +
> + /* chunk is a number of block every used
> + * slot will get. make sure it isn't 0 */
> + chunk = free + used_slots - 1;
> + do_div(chunk, used_slots);
> +
> + for (i = 0; i < NR_CPUS; i++) {
all these NR_CPUS loops need to go away. Use either
for_each_possible_cpu() or, preferably, for_each_online_cpu() and a hotplug
notifier.
Why is this code using per-cpu data at all, btw? These optimisations tend
to be marginal in filesystems. What is the perfomance impact of making
this data be single-superblock-wide-instance?
> +int ext4_reserve_init(struct super_block *sb)
> +{
> + struct ext4_sb_info *sbi = EXT4_SB(sb);
> + struct ext4_reservation_slot *rs;
> + int i;
> +
> + rs = kmalloc(sizeof(struct ext4_reservation_slot) * NR_CPUS, GFP_KERNEL);
alloc_percpu()
next prev parent reply other threads:[~2006-12-23 22:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-22 20:20 [RFC] delayed allocation for ext4 Alex Tomas
2006-12-22 20:23 ` [RFC] booked-page-flag.patch Alex Tomas
2006-12-22 20:25 ` [RFC] ext4-block-reservation.patch Alex Tomas
2006-12-23 22:40 ` Andrew Morton [this message]
2006-12-23 22:47 ` Alex Tomas
2006-12-22 20:28 ` [RFC] ext4-delayed-allocation.patch Alex Tomas
2006-12-23 22:59 ` Andrew Morton
2006-12-23 3:31 ` [RFC] delayed allocation for ext4 David Chinner
2006-12-23 9:27 ` Christoph Hellwig
2006-12-23 19:15 ` Alex Tomas
2006-12-29 2:50 ` David Chinner
2006-12-23 19:09 ` Alex Tomas
2006-12-29 2:52 ` David Chinner
2006-12-29 4:56 ` Alex Tomas
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=20061223144059.f515a3a3.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=alex@clusterfs.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®