Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2393643ybg; Fri, 5 Jun 2020 12:47:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW1QgZ8fgFIKgsHk9dOaC6XkebOxQGQA3vt18P0pzCmeUi4UfnfW1p2GM60brjIBKTmLe6 X-Received: by 2002:a05:6402:1d96:: with SMTP id dk22mr11186175edb.258.1591386431007; Fri, 05 Jun 2020 12:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591386431; cv=none; d=google.com; s=arc-20160816; b=J7Mt84u3mXqJc28JPjB7tV1/RiauBXQK8QbvX31FK6Y4VvIQOHhs1TXI8FitxhgKtT h6EnYCOKAN6MEW/QHNbn+sznfappi6HNh3n8CeEXz+kpU72Og/i4v1fnLK5udEmiC+ah qqByYK8htxFGj/bEoVytbAApk4v1vlnfklDJNiKOvJjaD3DHmCcU63B8ZqetipUa66Hw qa2hUB7AKhV42HawRVGdfJQvX7uOfhdNBFqKVEVsU1hq7aswDJIybAnMcldwxpL8746W bRmTM1AnDsXXWadosgYb/hUGC+ktTK+nhSwkQspmMi0wskKhfuFhxcJM9xCsBSAVJs5B 9Ztg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=7O2pzME1vhDGlSU4vtoXmUIFM9CRZIMY/qMgNmXhNzE=; b=p2VT1RedM/ZyFQSQqyzHB9dfSyWcAR9Yi6581yOfiGwmSkhsc7GrmnZjVcoIWADRpf w75iVxuQ5aMI9Salvy47CvR9o2YOK6H4sPkvKCbF65VrYVDPQl+1DpV6w9WhBadqTrbU 2BBK5/BWKy+tcEonvmjh7OjqprfC2CqP8o7FHiluqGMiwCtFcc2VbI5+Td62AHNcwaub 3MqYIfIxOLoo/4GRu+Z+teORWYmVIZVCYviDnx2t9ma+bKM4sgEHr6AT7sjHoEEruflv 7uR1yDoUl0qPaAoWrvck82noiK68qItxKHcdz/EEAtR2XG4KoLgnwl6MY9hdUFlmkv90 JzSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc1si4659214edb.123.2020.06.05.12.46.48; Fri, 05 Jun 2020 12:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728020AbgFETos (ORCPT + 99 others); Fri, 5 Jun 2020 15:44:48 -0400 Received: from mail-vs1-f68.google.com ([209.85.217.68]:39987 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727010AbgFETor (ORCPT ); Fri, 5 Jun 2020 15:44:47 -0400 Received: by mail-vs1-f68.google.com with SMTP id u17so6256362vsu.7 for ; Fri, 05 Jun 2020 12:44:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7O2pzME1vhDGlSU4vtoXmUIFM9CRZIMY/qMgNmXhNzE=; b=oOaBN7Cmmy1JMrC2+RLdPNtSGf7mfPPf4scvgN/y241gi5HLRcSeZI9vZP3ByfJlLL ryqh+U6oljxC2C+H61OQR+refFL7d1FikfhKK9ZUIY3Z/LgEIwYs+KPOwyXU2/4912VY 5zxzzvNEHVujnf1Uz3RBoovnW5Zn9tqpqBQwIW6VTHFfxUZRJ1UsC5M7ylol37jcIcTj bKb737f/cvx4nvmWy2aGY9qJalSIi1D6JNxxsT1GIncnytwqtYqzDa0AQS1Yk90ct032 0iHuPG9iK5c9/auJUP5LUkirQa/qbYqUMgU35RVdZmnSPXqPbcKtZZxnUMHAQLb/vto5 NvBA== X-Gm-Message-State: AOAM530n9f7azOKGwbPNuTnBsCKSW3aa6bbvUWyzqb5Tr6Q6nND+MgFL w/erqTkR5HiWDpJ2cf6v5Po= X-Received: by 2002:a67:800f:: with SMTP id b15mr4351196vsd.220.1591386286149; Fri, 05 Jun 2020 12:44:46 -0700 (PDT) Received: from google.com (239.145.196.35.bc.googleusercontent.com. [35.196.145.239]) by smtp.gmail.com with ESMTPSA id e193sm1243243vke.49.2020.06.05.12.44.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 12:44:45 -0700 (PDT) Date: Fri, 5 Jun 2020 19:44:43 +0000 From: Dennis Zhou To: Roman Gushchin Cc: Andrew Morton , Tejun Heo , Christoph Lameter , Johannes Weiner , Michal Hocko , Shakeel Butt , 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() Message-ID: <20200605194443.GA224745@google.com> References: <20200528232508.1132382-1-guro@fb.com> <20200528232508.1132382-2-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200528232508.1132382-2-guro@fb.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 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