All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zach Brown <zab@zabbo.net>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.5.39 list_head debugging
Date: Sun, 29 Sep 2002 10:27:31 -0400	[thread overview]
Message-ID: <20020929102731.A13755@bitchcake.off.net> (raw)
In-Reply-To: <Pine.LNX.4.44.0209291027120.12583-100000@localhost.localdomain>; from mingo@elte.hu on Sun, Sep 29, 2002 at 10:33:15AM +0200

> > This patch adds some straight-forward assertions that check the
> > validity of arguments to the list_* inlines. [...]
> 
> +	BUG_ON(list == NULL);
> +	BUG_ON(list->next == NULL);
> +	BUG_ON(list->prev == NULL);
> 
> these checks are not needed - they'll trivially be oopsing when trying to
> use them, right?

sure, it's just nice to get the message immediately.

> +	BUG_ON((list->next == list) && (list->prev != list));
> +	BUG_ON((list->prev == list) && (list->next != list));
> 
> arent these redundant? If list->next->prev == list and list->prev->next ==
> list, then if list->next == list then list->prev == list. Ditto for the 
> other rule.

I don't think so.  these check for the very strange list state that
results from double list_adds.  its an accident of the ordering of our
member assignments that result in a pretty strange looking list state
after a double_add.  it passes all the double-linked assertions
(list->{next,prev}->{prev,next} == list) but doesn't follow the rule
that both prev and next must point to list if either of them do.

> so i think we only need the following two checks:
> 
> +	BUG_ON(list->next->prev != list);
> +	BUG_ON(list->prev->next != list);

try a double list_add().  these will pass, but the list is not a happy
camper :)

> and we could as well add these unconditionally (no .config complexity
> needed), until 2.6.0 or so, hm?

I'd love that.  It was just a bit of sugar to help the medicine go down.

-- 
 zach

  reply	other threads:[~2002-09-29 14:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-29  5:58 [PATCH] 2.5.39 list_head debugging Zach Brown
2002-09-29  6:12 ` Andrew Morton
2002-09-29  6:24   ` Zach Brown
2002-09-29  8:33 ` Ingo Molnar
2002-09-29 14:27   ` Zach Brown [this message]
2002-09-29 14:28     ` Martin J. Bligh
2002-09-29 14:30   ` Zach Brown
2002-09-29 17:22 ` Dave Jones
2002-09-29 20:22   ` Zach Brown

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=20020929102731.A13755@bitchcake.off.net \
    --to=zab@zabbo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    /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.