From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 101BBC433E0 for ; Fri, 5 Jun 2020 19:44:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B27882077D for ; Fri, 5 Jun 2020 19:44:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B27882077D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 18F0280007; Fri, 5 Jun 2020 15:44:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 13ED58E0006; Fri, 5 Jun 2020 15:44:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0542780007; Fri, 5 Jun 2020 15:44:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id DF8CC8E0006 for ; Fri, 5 Jun 2020 15:44:47 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 9DD1D824805A for ; Fri, 5 Jun 2020 19:44:47 +0000 (UTC) X-FDA: 76896185814.07.dime19_230895526da2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 709AD1803F9A4 for ; Fri, 5 Jun 2020 19:44:47 +0000 (UTC) X-HE-Tag: dime19_230895526da2 X-Filterd-Recvd-Size: 4598 Received: from mail-vs1-f68.google.com (mail-vs1-f68.google.com [209.85.217.68]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Jun 2020 19:44:46 +0000 (UTC) Received: by mail-vs1-f68.google.com with SMTP id l10so3624168vsr.10 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=AjkDpK0wyTIecQVFtfoZwi8PF2zsmFd7R6q26j8mm7EMha52j6Tyz2NKko6+NwMmkI L572TUnuMG2/nCWmWFzApX6jxZ7O2VHVy/mVIx7wXyU3gar8CbmYf9xklyEkr2iI0hne 7HvtOB/9mO5VlFZ+fp4o6sPjyS+UlTdmun5BGQiz+4il6F6+oqw+w7W8g2cftsgPYOSy iRBhAjC8Lxglxj5qN+AM+8gKAEcrY03NVmiBfbvvivHm2vaxuLsTliSZ8YEe2I59QmAV a2wkX/0cjkFbF7vWb8fsWEZ2reyRkWcaKc7Ix9zLc7rPEvoSxElm/EJgRa0/y4jzs7DK z53Q== X-Gm-Message-State: AOAM533Dq4HdkxY61bllpPbUldegPoctW0W39yljxyvPs/gClJ5oTV1D 52gpq3s6OPbdkeGRvqOq8zE= X-Google-Smtp-Source: ABdhPJxi3wTB0D2ZCuYcHfkn/Z14lRXDjvpemIQD8fMCnjN6oWo3DnaDcnWW8UOh+rafBSIJJbRhIQ== 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> X-Rspamd-Queue-Id: 709AD1803F9A4 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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