Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752784AbcLIWFA (ORCPT ); Fri, 9 Dec 2016 17:05:00 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:45622 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750827AbcLIWE6 (ORCPT ); Fri, 9 Dec 2016 17:04:58 -0500 X-ME-Sender: X-Sasl-enc: cbxy+Qjt8uBgeEuXxbxZSLzTfPM17VUPCxLIb5ce9lMw 1481321097 Subject: Re: md: Combine two kmalloc() calls into one in sb_equal() To: SF Markus Elfring References: <71044708-c5e4-3a14-b162-dfc600311a60@fastmail.fm> Cc: linux-raid@vger.kernel.org, Shaohua Li , LKML , kernel-janitors@vger.kernel.org From: Bernd Schubert Message-ID: Date: Fri, 9 Dec 2016 23:04:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 390 Lines: 12 On 09.12.2016 22:58, SF Markus Elfring wrote: >> Irrelevant, the variable is not used before checking it. > > * Will it be more appropriate to attempt another memory allocation only if > the previous one succeeded already? > > * Can it be a bit more efficient to duplicate only the required data > in a single function call before? How many memory allocations do you expect to fail?