[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <01000164ebe0d06f-8f639717-8d32-4eb9-9cc1-708332b12ca6-000000@email.amazonses.com>
Date: Mon, 30 Jul 2018 15:48:56 +0000
From: Christopher Lameter <cl@...ux.com>
To: Vlastimil Babka <vbabka@...e.cz>
cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
Roman Gushchin <guro@...com>, Michal Hocko <mhocko@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Mel Gorman <mgorman@...hsingularity.net>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3 7/7] mm, slab: shorten kmalloc cache names for large
sizes
On Wed, 18 Jul 2018, Vlastimil Babka wrote:
> +static const char *
> +kmalloc_cache_name(const char *prefix, unsigned int size)
> +{
> +
> + static const char units[3] = "\0kM";
> + int idx = 0;
> +
> + while (size >= 1024 && (size % 1024 == 0)) {
> + size /= 1024;
> + idx++;
> + }
> +
> + return kasprintf(GFP_NOWAIT, "%s-%u%c", prefix, size, units[idx]);
> +}
This is likely to occur elsewhere in the kernel. Maybe generalize it a
bit?
Acked-by: Christoph Lameter <cl@...ux.com>
Powered by blists - more mailing lists