Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1954300imu; Fri, 23 Nov 2018 02:38:36 -0800 (PST) X-Google-Smtp-Source: AJdET5exKuZSdDcni+NWvKs2hz8ZytjnwLUprlNWoHi/CzsZAzsZ/2sg73VcZVJdDFiDg/CfiNRJ X-Received: by 2002:a62:ae12:: with SMTP id q18mr15392361pff.126.1542969516081; Fri, 23 Nov 2018 02:38:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542969516; cv=none; d=google.com; s=arc-20160816; b=CF0NemT6jId5X1WFhbfjfSfLyNGQQeEqsK8rxTyMVeXkv6gAa62ypcUIX1Gou7LlWw ZOgkVlewVwVqoMU6EzmXESICGB5BMGkfnKh47bHcMEmr3aMYWPI/osf8uYXjGZXZWdPJ NRNDTdaH75ulnRXcsYQ6IZnmP0x9SDi78uHNnTPbPoXg9ioAJLXHtYd75QWMaiopVqsZ h9rU11P0I3rMr7RJ+AY5aGK8t4zc7inup5CwbNBBSa8viClft4TW2orOfdocyepR5HZy DbA/bWiRb0uij1nKfvNVAVITDR/nkOtj314x6ju/mHrZxhWTYzSwy9YYRrhcEYN8FqJw TZGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=M1he82y3DqfbaN2M8pteazLduS/FGoBLOrDWYWTRIxo=; b=G04OxjTqHrBUfQVvgUgF3ZdzRZl0uBmN6n2LDmynPVMd7w2rmtRXziTywNO/essags kr3xs57RD/a38wTbgficG+RNj1RQp/mA+ZI+ItNUdDNrlA9/PapNRVOj/DY7U9ba+CQG Ybc8/4JztSU1aV6SGEeNWRXVie+AhSXrkmZUs5/fNxXNeFz2PFJiwZYZrfvguZO9PtoG 1vqiTmPftK26QArbd6XofeBSlYjcQnViTdH1SHcgJua1go/vMvfgwR6srJ7cGQhZpgCC sgcoX7EYbzmOHKZ6oFh5c/HacmunFoTYbba/kqyAyfbjd4xTHtj4EDUzfzSQ12myydAZ DlYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SLWWNssT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si50596991pgb.371.2018.11.23.02.38.20; Fri, 23 Nov 2018 02:38:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SLWWNssT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394186AbeKVVCb (ORCPT + 99 others); Thu, 22 Nov 2018 16:02:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:56006 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387625AbeKVVCb (ORCPT ); Thu, 22 Nov 2018 16:02:31 -0500 Received: from localhost (unknown [95.99.132.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3AC5920684; Thu, 22 Nov 2018 10:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542882223; bh=E2LADVbCbBFia8VLdZLhkv1JGhmg0kg/n8W84RF/zQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SLWWNssTNq9Lp4LlMaxNtBV4ug1gxaT2OkHGeP/VZH99fj3y5v4ED1a6QE0tsi5+3 3SCyRVKMAJLIiWgClETaq/iLpq02UxD+6fbEryNwwKxGT+iV2bnb9THNAR9Q+3ePdn ICMUl1imziGCqbgKg4Vd4eXTufy9cNCf9SrnUEHI= Date: Thu, 22 Nov 2018 11:23:39 +0100 From: Greg Kroah-Hartman To: Gao Xiang Cc: devel@driverdev.osuosl.org, linux-erofs@lists.ozlabs.org, Chao Yu , LKML , weidu.du@huawei.com, Miao Xie Subject: Re: [PATCH 07/10] staging: erofs: separate into init_once / always Message-ID: <20181122102339.GG3189@kroah.com> References: <20181120143425.43637-1-gaoxiang25@huawei.com> <20181120143425.43637-8-gaoxiang25@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181120143425.43637-8-gaoxiang25@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 10:34:22PM +0800, Gao Xiang wrote: > `z_erofs_vle_workgroup' is heavily generated in the decompression, > for example, it resets 32 bytes redundantly for 64-bit platforms > even through Z_EROFS_VLE_INLINE_PAGEVECS + Z_EROFS_CLUSTER_MAX_PAGES, > default 4, pages are stored in `z_erofs_vle_workgroup'. > > As an another example, `struct mutex' takes 72 bytes for our kirin > 64-bit platforms, it's unnecessary to be reseted at first and > be initialized each time. > > Let's avoid filling all `z_erofs_vle_workgroup' with 0 at first > since most fields are reinitialized to meaningful values later, > and pagevec is no need to initialized at all. > > Reviewed-by: Chao Yu > Signed-off-by: Gao Xiang > --- > drivers/staging/erofs/unzip_vle.c | 34 +++++++++++++++++++++++++++++----- > 1 file changed, 29 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c > index ede3383ac601..4e5843e8ee35 100644 > --- a/drivers/staging/erofs/unzip_vle.c > +++ b/drivers/staging/erofs/unzip_vle.c > @@ -43,12 +43,38 @@ static inline int init_unzip_workqueue(void) > return z_erofs_workqueue ? 0 : -ENOMEM; > } > > +static void init_once(void *ptr) > +{ > + struct z_erofs_vle_workgroup *grp = ptr; > + struct z_erofs_vle_work *const work = > + z_erofs_vle_grab_primary_work(grp); > + unsigned int i; > + > + mutex_init(&work->lock); > + work->nr_pages = 0; > + work->vcnt = 0; > + for (i = 0; i < Z_EROFS_CLUSTER_MAX_PAGES; ++i) > + grp->compressed_pages[i] = NULL; > +} > + > +static void init_always(struct z_erofs_vle_workgroup *grp) > +{ > + struct z_erofs_vle_work *const work = > + z_erofs_vle_grab_primary_work(grp); > + > + atomic_set(&grp->obj.refcount, 1); > + grp->flags = 0; > + > + DBG_BUGON(work->nr_pages); > + DBG_BUGON(work->vcnt); How can these ever be triggered? I understand the need for debugging code when you are writing code, but at this point it shouldn't be needed anymore, right? thanks, greg k-h