lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 4 Oct 2015 20:37:08 -0700
From:	Davidlohr Bueso <dave@...olabs.net>
To:	Geliang Tang <geliangtang@....com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
	Hugh Dickins <hughd@...gle.com>,
	"Peter Zij lstra (Intel)" <peterz@...radead.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Joonsoo Kim <js1304@...il.com>, Arnd Bergmann <arnd@...db.de>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Leon Romanovsky <leon@...n.nu>,
	Oleg Nesterov <oleg@...hat.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] mm/nommu: drop unlikely behind BUG_ON()

On Mon, 05 Oct 2015, Geliang Tang wrote:

>On Sun, Oct 04, 2015 at 06:50:55PM -0700, Davidlohr Bueso wrote:
>> On Sun, 04 Oct 2015, Geliang Tang wrote:
>>
>> >BUG_ON() already contain an unlikely compiler flag. Drop it.
>> >
>> >Signed-off-by: Geliang Tang <geliangtang@....com>
>>
>> Acked-by: Davidlohr Bueso <dave@...olabs.net>
>>
>> ... but I believe you do have some left:
>>
>> drivers/scsi/scsi_lib.c:                BUG_ON(unlikely(count > ivecs));
>> drivers/scsi/scsi_lib.c:                BUG_ON(unlikely(count > queue_max_integrity_segments(rq->q)));
>> kernel/sched/core.c:    BUG_ON(unlikely(task_stack_end_corrupted(prev)));
>
>Thanks for your review, the left have been sended out already in two other patches.

So given that the 'unlikely' is based on CONFIG_BUG/HAVE_ARCH_BUG_ON, the
changelog needs to be rewritten. Ie mentioning at least why it should be
ok to drop the redundant predictions: (1) For !CONFIG_BUG cases, the bug call
is a no-op, so we couldn't care less and the change is ok. (2) ppc and
mips, which HAVE_ARCH_BUG_ON, do not rely on branch predictions as it seems
to be pointless[1] and thus callers should not be trying to push an optimization
in the first place.

Also, I think that all the changes should be in the same patch. Logically,
this is a tree wide change, and trivial enough. But I don't really have a
preference.

Thanks,
Davidlohr

[1] http://lkml.iu.edu/hypermail/linux/kernel/1101.3/02289.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ