linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Tomas <alex@clusterfs.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Alex Tomas <alex@clusterfs.com>,
	linux-ext4@vger.kernel.org, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] ext4-block-reservation.patch
Date: Sun, 24 Dec 2006 01:47:00 +0300	[thread overview]
Message-ID: <m3r6uqtel7.fsf@bzzz.home.net> (raw)
In-Reply-To: <20061223144059.f515a3a3.akpm@osdl.org> (Andrew Morton's message of "Sat\, 23 Dec 2006 14\:40\:59 -0800")


Hi,

>>>>> Andrew Morton (AM) writes:

 AM> Should be ____cacheline_aligned_in_smp.

 AM> That's assuming it needs to be cacheline aligned at all.  It can consume a
 AM> lot of space.

the idea is to make block reservation cheap because it's called
for every page. 

 AM> <looks>

 AM> oh, this should be allocated with alloc_percpu(), in which case the
 AM> open-coded alignment can perhaps go away.

got it.

 >> +
 >> +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();

 AM> use get_cpu() here.

ok.

 >> +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++) {

 AM> all these NR_CPUS loops need to go away.  Use either
 AM> for_each_possible_cpu() or, preferably, for_each_online_cpu() and a hotplug
 AM> notifier.

hmm, i see.

 AM> Why is this code using per-cpu data at all, btw?  These optimisations tend
 AM> to be marginal in filesystems.  What is the perfomance impact of making
 AM> this data be single-superblock-wide-instance?

well, even on 2way box a single-lock reservation was in top10.

thanks, Alex

  reply	other threads:[~2006-12-23 23:13 UTC|newest]

Thread overview: 16+ 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
2006-12-23 22:47     ` Alex Tomas [this message]
2006-12-22 20:28 ` [RFC] ext4-delayed-allocation.patch Alex Tomas
2006-12-23 22:59   ` Andrew Morton
2007-01-12 14:45   ` Valerie Clement
2007-01-12 14:52     ` Alex Tomas
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=m3r6uqtel7.fsf@bzzz.home.net \
    --to=alex@clusterfs.com \
    --cc=akpm@osdl.org \
    --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;
as well as URLs for NNTP newsgroup(s).