From: Dennis Zhou <dennis@kernel.org>
To: Roman Gushchin <guro@fb.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Shakeel Butt <shakeelb@google.com>,
linux-mm@kvack.org, kernel-team@fb.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/5] percpu: return number of released bytes from pcpu_free_area()
Date: Fri, 5 Jun 2020 19:44:43 +0000 [thread overview]
Message-ID: <20200605194443.GA224745@google.com> (raw)
In-Reply-To: <20200528232508.1132382-2-guro@fb.com>
On Thu, May 28, 2020 at 04:25:04PM -0700, Roman Gushchin wrote:
> To implement accounting of percpu memory we need the information
> about the size of freed object. Return it from pcpu_free_area().
>
> Signed-off-by: Roman Gushchin <guro@fb.com>
> ---
> mm/percpu.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/mm/percpu.c b/mm/percpu.c
> index 696367b18222..aa36b78d45a6 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1211,11 +1211,14 @@ static int pcpu_alloc_area(struct pcpu_chunk *chunk, int alloc_bits,
> *
> * This function determines the size of an allocation to free using
> * the boundary bitmap and clears the allocation map.
> + *
> + * RETURNS:
> + * Number of freed bytes.
> */
> -static void pcpu_free_area(struct pcpu_chunk *chunk, int off)
> +static int pcpu_free_area(struct pcpu_chunk *chunk, int off)
> {
> struct pcpu_block_md *chunk_md = &chunk->chunk_md;
> - int bit_off, bits, end, oslot;
> + int bit_off, bits, end, oslot, freed;
>
> lockdep_assert_held(&pcpu_lock);
> pcpu_stats_area_dealloc(chunk);
> @@ -1230,8 +1233,10 @@ static void pcpu_free_area(struct pcpu_chunk *chunk, int off)
> bits = end - bit_off;
> bitmap_clear(chunk->alloc_map, bit_off, bits);
>
> + freed = bits * PCPU_MIN_ALLOC_SIZE;
> +
> /* update metadata */
> - chunk->free_bytes += bits * PCPU_MIN_ALLOC_SIZE;
> + chunk->free_bytes += freed;
>
> /* update first free bit */
> chunk_md->first_free = min(chunk_md->first_free, bit_off);
> @@ -1239,6 +1244,8 @@ static void pcpu_free_area(struct pcpu_chunk *chunk, int off)
> pcpu_block_update_hint_free(chunk, bit_off, bits);
>
> pcpu_chunk_relocate(chunk, oslot);
> +
> + return freed;
> }
>
> static void pcpu_init_md_block(struct pcpu_block_md *block, int nr_bits)
> --
> 2.25.4
>
Sorry for the delay.
Acked-by: Dennis Zhou <dennis@kernel.org>
What's the status of the depending patches? It might be easiest to have
Andrew pick these up once the depending patch series is settled.
Thanks,
Dennis
next parent reply other threads:[~2020-06-05 19:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200528232508.1132382-1-guro@fb.com>
[not found] ` <20200528232508.1132382-2-guro@fb.com>
2020-06-05 19:44 ` Dennis Zhou [this message]
[not found] ` <20200528232508.1132382-3-guro@fb.com>
2020-06-05 19:49 ` [PATCH v1 2/5] mm: memcg/percpu: account percpu memory to memory cgroups Dennis Zhou
2020-06-05 22:44 ` Roman Gushchin
[not found] ` <20200528232508.1132382-4-guro@fb.com>
2020-06-05 19:53 ` [PATCH v1 3/5] mm: memcg/percpu: per-memcg percpu memory statistics Dennis Zhou
[not found] ` <20200528232508.1132382-5-guro@fb.com>
2020-06-05 19:54 ` [PATCH v1 4/5] mm: memcg: charge memcg percpu memory to the parent cgroup Dennis Zhou
[not found] ` <20200528232508.1132382-6-guro@fb.com>
2020-06-05 20:07 ` [PATCH v1 5/5] kselftests: cgroup: add perpcu memory accounting test Dennis Zhou
2020-06-05 22:47 ` Roman Gushchin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200605194443.GA224745@google.com \
--to=dennis@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox