Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754899AbbHYCkW (ORCPT ); Mon, 24 Aug 2015 22:40:22 -0400 Received: from mail-bl2on0124.outbound.protection.outlook.com ([65.55.169.124]:28000 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751984AbbHYCkU convert rfc822-to-8bit (ORCPT ); Mon, 24 Aug 2015 22:40:20 -0400 From: Zhao Qiang To: Laura Abbott , Scott Wood CC: "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "lauraa@codeaurora.org" , Xiaobo Xie , "benh@kernel.crashing.org" , Li Leo , "paulus@samba.org" Subject: RE: [PATCH v6 1/3] genalloc:support memory-allocation with bytes-alignment to genalloc Thread-Topic: [PATCH v6 1/3] genalloc:support memory-allocation with bytes-alignment to genalloc Thread-Index: AQHQ3lB3c5XRxGvlik2abkrI76vQZZ4bx5eAgAA6DyA= Date: Tue, 25 Aug 2015 02:40:09 +0000 Message-ID: References: <1440408703-6113-1-git-send-email-qiang.zhao@freescale.com> <55DBA477.5020608@redhat.com> In-Reply-To: <55DBA477.5020608@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=qiang.zhao@freescale.com; x-originating-ip: [192.158.241.86] x-microsoft-exchange-diagnostics: 1;DM2PR0301MB0783;5:pflcFud5y1qPFC5wo6DbAvMKI7YO52NAhvBEZOOmP23mEQMk5bkWUrbKriMGodDWdBic/SPpumkk6Bk+FPFKsUyGv0oOjI6ptsuUg1XMIMK7sIpfCBsyDa4m2j8cGQtfJqASihQSbjS0Q3cEbr0sXg==;24:JaRAV9w1Z4nsEmNHgOpruyc4mWbJZm6IpJeEZh9BDZwr8ZDC71XQRLxnegDe5k0ojoi8ctm4OrerQ1fR+3tquBTt0exCpsPAFBJn3cXZ/es=;20:qsbiLHjk5ADfDJeKTdIcMBW1N535nClHTZ6P9duVOxL3G5to1IUSVg69pi726Uo5yhDg+a1tan2E5BA0hgmIbA== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0783; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(8121501046)(5005006)(3002001);SRVR:DM2PR0301MB0783;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0783; x-forefront-prvs: 06793E740F x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(479174004)(199003)(189002)(377454003)(164054003)(13464003)(24454002)(62966003)(106356001)(74316001)(105586002)(101416001)(99286002)(106116001)(92566002)(64706001)(5003600100002)(77156002)(5002640100001)(10400500002)(76576001)(2950100001)(97736004)(19580405001)(66066001)(19580395003)(4001540100001)(189998001)(5007970100001)(87936001)(33656002)(5001920100001)(86362001)(5001960100002)(5004730100002)(40100003)(122556002)(102836002)(4001450100002)(46102003)(5001830100001)(50986999)(54356999)(76176999)(77096005)(5001860100001)(2900100001)(68736005)(81156007)(5001770100001)(2656002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB0783;H:SN1PR0301MB1550.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Aug 2015 02:40:09.6481 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0301MB0783 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3152 Lines: 88 On 08/25/2015 07:11 AM, Laura Abbott wrote: > -----Original Message----- > From: Laura Abbott [mailto:labbott@redhat.com] > Sent: Tuesday, August 25, 2015 7:11 AM > To: Zhao Qiang-B45475; Wood Scott-B07421 > Cc: linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; > lauraa@codeaurora.org; Xie Xiaobo-R63061; benh@kernel.crashing.org; Li > Yang-Leo-R58472; paulus@samba.org > Subject: Re: [PATCH v6 1/3] genalloc:support memory-allocation with > bytes-alignment to genalloc > > On 08/24/2015 02:31 AM, Zhao Qiang wrote: > > Bytes alignment is required to manage some special RAM, so add > > gen_pool_first_fit_align to genalloc, meanwhile add > > gen_pool_alloc_data to pass data to gen_pool_first_fit_align(modify > > gen_pool_alloc as a wrapper) > > > > Signed-off-by: Zhao Qiang > > --- > > Changes for v6: > > - patches set v6 include a new patch because of using > > - genalloc to manage QE MURAM, patch 0001 is the new > > - patch, adding bytes alignment for allocation for use. > > > > include/linux/genalloc.h | 23 +++++++++++++++---- > > lib/genalloc.c | 58 > +++++++++++++++++++++++++++++++++++++++++++----- > > 2 files changed, 72 insertions(+), 9 deletions(-) > > > > diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h index > > 1ccaab4..55da07e 100644 > > --- a/include/linux/genalloc.h > > +++ b/include/linux/genalloc.h > > @@ -34,6 +34,7 @@ > > > > struct device; > > struct device_node; > > +struct gen_pool; > > > > /** > > * Allocation callback function type definition @@ -47,7 +48,7 @@ > > typedef unsigned long (*genpool_algo_t)(unsigned long *map, > > unsigned long size, > > unsigned long start, > > unsigned int nr, > > - void *data); > > + void *data, struct gen_pool *pool); > > > > /* > > * General purpose special memory pool descriptor. > > @@ -73,6 +74,13 @@ struct gen_pool_chunk { > > unsigned long bits[0]; /* bitmap for allocating memory chunk > */ > > }; > > > > +/* > > + * gen_pool data descriptor for gen_pool_first_fit_align. > > + */ > > +struct genpool_data_align { > > + int align; /* alignment by bytes for starting address */ > > +}; > > + > > (sorry for chiming in late, I've been traveling) > > Is there an advantage here to wrapping this in a structure instead of > just passing a pointer to an align integer? Please look at the commit message for ca279cf1065fb689abea1dc7d8c11787729bb185 which adds "data": "As I can't predict all the possible requirements/needs for all allocation uses cases, I add a "free" field 'void *data' to pass any needed information to the allocation function. For example 'data' could be used to handle a structure where you store the alignment, the expected memory bank, the requester device, or any information that could influence the allocation algorithm." > > Thanks, > Laura -Zhao -- 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/