From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbcCGM0U (ORCPT ); Mon, 7 Mar 2016 07:26:20 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:23794 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752669AbcCGM0E (ORCPT ); Mon, 7 Mar 2016 07:26:04 -0500 Subject: Re: [PATCH 1/1] dma-mapping: to avoid exception when cpu_addr is NULL To: One Thousand Gnomes References: <1457342485-16628-1-git-send-email-thunder.leizhen@huawei.com> <20160307114116.54160865@lxorguk.ukuu.org.uk> CC: Andrew Morton , Marek Szyprowski , Will Deacon , linux-kernel , Zefan Li , Xinwei Hu , Tianhong Ding , Hanjun Guo From: "Leizhen (ThunderTown)" Message-ID: <56DD7268.6030503@huawei.com> Date: Mon, 7 Mar 2016 20:22:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160307114116.54160865@lxorguk.ukuu.org.uk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090201.56DD7277.0263,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1ef151569c40d2d2bdaa7f351d8f2bfe Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/3/7 19:41, One Thousand Gnomes wrote: > On Mon, 7 Mar 2016 17:21:25 +0800 > Zhen Lei wrote: > >> Do this to keep consistent with kfree, which tolerate ptr is NULL. >> >> Signed-off-by: Zhen Lei > > This is inlined code so you are adding extra logic to every single > instance of a call to the function. What is it's total effect on kernel > size ? This a simple if statement, I think it will only generates two instructions. Maybe I need move it into function dma_free_attrs, as below: if (!ops->free || !cpu_addr) return; So that, it only generates one instruction. And dma_free_noncoherent can also be impacted. Or I changed it to BUG_ON(!cpu_addr)? Otherwise, I move it into ops->free, but that maybe more ARCHs. > > Alan > > . >