linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-mm@kvack.org, kosaki.motohiro@gmail.com
Subject: Re: [patch] mm, mempolicy: make mempolicies robust against errors
Date: Wed, 07 Mar 2012 01:34:16 -0500	[thread overview]
Message-ID: <4F570168.6050008@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1203062151530.6424@chino.kir.corp.google.com>

(3/7/12 12:58 AM), David Rientjes wrote:
> On Wed, 7 Mar 2012, KOSAKI Motohiro wrote:
>
>>> It's unnecessary to BUG() in situations when a mempolicy has an
>>> unsupported mode, it just means that a mode doesn't have complete coverage
>>> in all mempolicy functions -- which is an error, but not a fatal error --
>>> or that a bit has flipped.  Regardless, it's sufficient to warn the user
>>> in the kernel log of the situation once and then proceed without crashing
>>> the system.
>>>
>>> This patch converts nearly all the BUG()'s in mm/mempolicy.c to
>>> WARN_ON_ONCE(1) and provides the necessary code to return successfully.
>>
>> I'm sorry. I simple don't understand the purpose of this patch. every
>> mem policy  syscalls have input check then we can't hit BUG()s in
>> mempolicy.c. To me, BUG() is obvious notation than WARN_ON_ONCE().
>>
>
> Right, this patch doesn't functionally change anything except it will (1)
> continue to warn users when there's a legitimate mempolicy code error by
> way of WARN_ON_ONCE() (which is good), just without crashing the machine
> unnecessarily and (2) allow the system to stay alive since no mempolicy
> error changed by this bug is fatal.  We should only be using BUG() when
> the side-effects of continuing are fatal; doing WARN_ON_ONCE(1) is
> sufficient annotation, I think, that this code should never be reached --
> BUG() has no advantage here.
>
>> We usually use WARN_ON_ONCE() for hw drivers code. Because of, the
>> warn-on mean "we believe this route never reach, but we afraid there
>> is crazy buggy hardware".
>>
>> And, now BUG() has renreachable() annotation. why don't it work?
>>
>>
>> #define BUG()                                                   \
>> do {                                                            \
>>          asm volatile("ud2");                                    \
>>          unreachable();                                          \
>> } while (0)
>>
>
> That's not compiled for CONFIG_BUG=n; such a config fallsback to
> include/asm-generic/bug.h which just does
>
> 	#define BUG()	do {} while (0)
>
> because CONFIG_BUG specifically _wants_ to bypass BUG()s and is reasonably
> protected by CONFIG_EXPERT.

So, I strongly suggest to remove CONFIG_BUG=n. It is neglected very long time and
much plenty code assume BUG() is not no-op. I don't think we can fix all place.

Just one instruction don't hurt code size nor performance.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-03-07  6:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-04 21:43 [patch] mm, mempolicy: dummy slab_node return value for bugless kernels David Rientjes
2012-03-06 20:15 ` Rafael Aquini
2012-03-07  0:08 ` Andrew Morton
2012-03-07  0:55   ` Rafael Aquini
2012-03-07  4:25   ` David Rientjes
2012-03-07  4:29     ` [patch] mm, mempolicy: make mempolicies robust against errors David Rientjes
2012-03-07  5:30       ` KOSAKI Motohiro
2012-03-07  5:58         ` David Rientjes
2012-03-07  6:34           ` KOSAKI Motohiro [this message]
2012-03-07  6:56             ` David Rientjes
2012-03-07 16:24               ` KOSAKI Motohiro
2012-03-07 21:06                 ` David Rientjes
2012-03-08 23:51             ` Andrew Morton
2012-04-26 14:58           ` Christoph Lameter
2012-03-07 11:12     ` [patch] mm, mempolicy: dummy slab_node return value for bugless kernels Glauber Costa
2012-03-07 21:04       ` David Rientjes

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=4F570168.6050008@gmail.com \
    --to=kosaki.motohiro@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.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 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).