From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Pekka Enberg" Subject: Re: [PATCH]use kzalloc in vfs where appropriate Date: Mon, 20 Mar 2006 09:25:06 +0200 Message-ID: <84144f020603192325h54fd3212l1f4846fd40b9f074@mail.gmail.com> References: <200603191429.21776.oliver@neukum.org> <1142784566.3018.18.camel@laptopd505.fenrus.org> <200603192150.23444.oliver@neukum.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Cc: "Arjan van de Ven" , "Matthew Wilcox" , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Return-path: Received: from zproxy.gmail.com ([64.233.162.195]:44886 "EHLO zproxy.gmail.com") by vger.kernel.org with ESMTP id S932181AbWCTHZH convert rfc822-to-8bit (ORCPT ); Mon, 20 Mar 2006 02:25:07 -0500 Received: by zproxy.gmail.com with SMTP id i11so1022700nzh for ; Sun, 19 Mar 2006 23:25:06 -0800 (PST) To: "Oliver Neukum" In-Reply-To: <200603192150.23444.oliver@neukum.org> Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi Oliver, On 3/19/06, Oliver Neukum wrote: > Yes it is. The generated code is identical. But on second thought this is still > not optimal. A full division is generated: > > xorl %edx, %edx > movl $2147483647, %eax > movq $0, 40(%rsp) > divq %rcx > movl $8, %edx > cmpq %rax, %rdx > ja .L313 > > Rewriting the test as: > n!=0 && n > INT_MAX / size > saves the division because size is much likelier to be a constant, and indeed > the code is better: > > cmpq $268435455, %rax > movq $0, 40(%rsp) > ja .L313 > > Is there anything I am missing? Did you check allyesconfig vmlinux size before and after? If it helps, like it probably does, post a patch! Pekka