public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Alex Tomas <alex@clusterfs.com>,
	linux-ext4@vger.kernel.org, Eric Sandeen <esandeen@redhat.com>
Subject: Re: ext4-block-reservation.patch
Date: Tue, 19 Jun 2007 16:10:49 -0600	[thread overview]
Message-ID: <20070619221048.GW5181@schatzie.adilger.int> (raw)
In-Reply-To: <46780D76.9040706@linux.vnet.ibm.com>

On Jun 19, 2007  22:38 +0530, Aneesh Kumar K.V wrote:
> This is what i have modified. I am yet to build test it. I am looking at 
> forward porting the
> mballoc patches and was planning to send it together.

> +int ext4_reserve_local(struct super_block *sb, int blocks)
> +{
> +	preempt_disable();
> +	rs = sbi->s_reservation_slots + smp_processor_id();

Should this be instead "rs = sbi->s_reservation_slots + get_cpu()"

> +	spin_lock(&rs->rs_lock);
> +	if (likely(rs->rs_reserved >= blocks)) {
> +		rs->rs_reserved -= blocks;
> +		rc = 0;
> +	}
> +	spin_unlock(&rs->rs_lock);
> +
> +	preempt_enable();

And "put_cpu()" here?

> +void ext4_rebalance_reservation(struct ext4_reservation_slot *rs, __u64 free)
> +{
> +	/* 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_each_possible_cpu(i) {
> +		if (free < chunk)
> +			chunk = free;
> +		if (rs[i].rs_reserved || i == smp_processor_id()) {
> +			rs[i].rs_reserved = chunk;
> +			free -= chunk;
> +			BUG_ON(free < 0);
> +		}
> +	}

Should we be assigning reservations to offline CPUs?  Doesn't it make sense
to assign 0 reservation to offline CPUs until they come back?  In the first
loop, if it is "for_each_possible_cpu()" it would drop reservations from
offline CPUs, and then the bottom one is "for_each_online_cpu()".

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.

      parent reply	other threads:[~2007-06-19 22:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 10:29 ext4-block-reservation.patch Aneesh Kumar K.V
2007-06-19 10:42 ` ext4-block-reservation.patch Alex Tomas
2007-06-19 15:05 ` ext4-block-reservation.patch Eric Sandeen
2007-06-19 17:08   ` ext4-block-reservation.patch Aneesh Kumar K.V
2007-06-19 17:16     ` ext4-block-reservation.patch Aneesh Kumar K.V
2007-06-19 22:10     ` Andreas Dilger [this message]

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=20070619221048.GW5181@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=alex@clusterfs.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=esandeen@redhat.com \
    --cc=linux-ext4@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