From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752673AbbEDKcp (ORCPT ); Mon, 4 May 2015 06:32:45 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:21712 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbbEDKcg (ORCPT ); Mon, 4 May 2015 06:32:36 -0400 Message-ID: <55473C1C.7000803@huawei.com> Date: Mon, 4 May 2015 17:30:04 +0800 From: "long.wanglong" User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: Tony Luck CC: Anton Vorontsov , Colin Cross , "Tony Luck" , LKML , peifeiyue , Marco Stornelli , "Anton Vorontsov" , Mark Salyzyn , Sergiu Iordache , Kees Cook Subject: Re: [PATCH v2] fs/pstore: Optimization function ramoops_init_przs References: <1426642867-194916-1-git-send-email-long.wanglong@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.88.174] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.554749FA.00CE,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 95bfb3c4348f5ee20a31eb34c2de5979 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/3/19 4:11, Kees Cook wrote: > On Tue, Mar 17, 2015 at 6:41 PM, Wang Long wrote: >> The value of cxt->record_size does not change in the loop, >> so this patch optimize the assign statement by dropping >> sz entirely and using cxt->record_size in its place. >> >> Signed-off-by: Wang Long > > Thanks! > > Acked-by: Kees Cook > > -Kees > >> --- >> fs/pstore/ram.c | 8 +++----- >> 1 file changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c >> index 44a549b..f29373d 100644 >> --- a/fs/pstore/ram.c >> +++ b/fs/pstore/ram.c >> @@ -394,18 +394,16 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, >> } >> >> for (i = 0; i < cxt->max_dump_cnt; i++) { >> - size_t sz = cxt->record_size; >> - >> - cxt->przs[i] = persistent_ram_new(*paddr, sz, 0, >> + cxt->przs[i] = persistent_ram_new(*paddr, cxt->record_size, 0, >> &cxt->ecc_info, >> cxt->memtype); >> if (IS_ERR(cxt->przs[i])) { >> err = PTR_ERR(cxt->przs[i]); >> dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", >> - sz, (unsigned long long)*paddr, err); >> + cxt->record_size, (unsigned long long)*paddr, err); >> goto fail_prz; >> } >> - *paddr += sz; >> + *paddr += cxt->record_size; >> } >> >> return 0; >> -- >> 1.8.3.4 >> >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> Please read the FAQ at http://www.tux.org/lkml/ > > > Hi Tony Luck, Could you please help to commit this patch? Thank you. Best Regards Wang Long