All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Nick Piggin <npiggin@suse.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [rfc][patch] slob: improvements
Date: Tue, 15 May 2007 10:17:31 -0500	[thread overview]
Message-ID: <20070515151731.GO11115@waste.org> (raw)
In-Reply-To: <20070515084305.GA28631@wotan.suse.de>

On Tue, May 15, 2007 at 10:43:05AM +0200, Nick Piggin wrote:
> This patch goes on top of my previous RCU patch, and has various
> improvements for slob I noticed while implementing said patch ;)
> 
> Comments?

I'm warming to this. Please check that the comment block at the top is
still accurate.

> +/*
> + * slob_block has a field 'units', which indicates size of block if +ve,
> + * or offset of next block if -ve (in SLOB_UNITs).
> + *
> + * Free blocks of size 1 unit simply contain the offset of the next block.
> + * Those with larger size contain their size in the first SLOB_UNIT of
> + * memory, and the offset of the next free block in the second SLOB_UNIT.
> + */
> +#if PAGE_SIZE <= (32*1024)
> +typedef s16 slobidx_t;
> +#else
> +typedef s32 slobidx_t;
> +#endif

This math is wrong because you're doing pointer math on slobidx_ts:

> +static slob_t *slob_next(slob_t *s)
> +{
> +	slob_t *base = (slob_t *)((unsigned long)s & PAGE_MASK);
> +	slobidx_t next;
> +
> +	if (s[0].units < 0)
> +		next = -s[0].units;
> +	else
> +		next = s[1].units;
> +	return base+next;
> +}

The max is 64K.

-- 
Mathematics is the supreme nostalgia of our time.

  reply	other threads:[~2007-05-15 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15  8:43 [rfc][patch] slob: improvements Nick Piggin
2007-05-15 15:17 ` Matt Mackall [this message]
2007-05-15 23:33   ` Nick Piggin
2007-07-13 18:27     ` Randy Dunlap
2007-07-13 18:35       ` Matt Mackall
2007-07-13 18:45         ` Andrew Morton

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=20070515151731.GO11115@waste.org \
    --to=mpm@selenic.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    /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.