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=-13.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 412F9C433E2 for ; Thu, 3 Sep 2020 13:46:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E52312071B for ; Thu, 3 Sep 2020 13:46:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E52312071B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 615126B0002; Thu, 3 Sep 2020 09:46:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C5016B0037; Thu, 3 Sep 2020 09:46:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DAB96B0055; Thu, 3 Sep 2020 09:46:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0175.hostedemail.com [216.40.44.175]) by kanga.kvack.org (Postfix) with ESMTP id 3B36A6B0002 for ; Thu, 3 Sep 2020 09:46:37 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E2D84180AD807 for ; Thu, 3 Sep 2020 13:46:36 +0000 (UTC) X-FDA: 77221875192.22.cats04_2712a94270aa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id B73F518038E6A for ; Thu, 3 Sep 2020 13:46:36 +0000 (UTC) X-HE-Tag: cats04_2712a94270aa X-Filterd-Recvd-Size: 2456 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 3 Sep 2020 13:46:36 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D6520ABD2; Thu, 3 Sep 2020 13:46:35 +0000 (UTC) Subject: Re: [PATCH] mm/percpu.c: Modify calculation of size of populated bitmap of chunk for memory allocation To: mcsmonk , linux-mm@kvack.org References: <20200903124116.1668-1-mcsmonk@gmail.com> Cc: Mike Rapoport , "Dennis Zhou (Facebook)" , Tejun Heo From: Vlastimil Babka Message-ID: Date: Thu, 3 Sep 2020 15:46:33 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200903124116.1668-1-mcsmonk@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: B73F518038E6A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 9/3/20 2:41 PM, mcsmonk wrote: > From: Sunghyun Jin > > Variable populated, which is a member of struct pcpu_chunk, is used as a > unit of size of unsigned long. > However, size of populated is miscounted. So, I fix this minor part. +CC folks who touched it last Nice find! Did you observe e.g. a panic that can be used in the commit log? Or were we always lucky thanks to alignment? Is there perhaps a commit that introduced the bug and we can use it as Fixes:? My brief look suggests 8ab16c43ea79 ("percpu: change the number of pages marked in the first_chunk pop bitmap") Thanks! > Signed-off-by: Sunghyun Jin > --- > mm/percpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/percpu.c b/mm/percpu.c > index f4709629e6de..1ed1a349eab8 100644 > --- a/mm/percpu.c > +++ b/mm/percpu.c > @@ -1316,7 +1316,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr, > > /* allocate chunk */ > alloc_size = sizeof(struct pcpu_chunk) + > - BITS_TO_LONGS(region_size >> PAGE_SHIFT); > + BITS_TO_LONGS(region_size >> PAGE_SHIFT) * sizeof(unsigned long); > chunk = memblock_alloc(alloc_size, SMP_CACHE_BYTES); > if (!chunk) > panic("%s: Failed to allocate %zu bytes\n", __func__, >