From patchwork Mon Oct 24 08:14:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318111wru; Mon, 24 Oct 2022 01:21:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5OsCp8IT2RdPMx0d1vFds/m2cuAxqWT/3Dl/qfPcdqvjvjvhYl8Q1QyBok4gV+NqTj4saZ X-Received: by 2002:a17:907:a43:b0:77b:ba98:d2f with SMTP id be3-20020a1709070a4300b0077bba980d2fmr26983538ejc.270.1666599663604; Mon, 24 Oct 2022 01:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599663; cv=none; d=google.com; s=arc-20160816; b=wol7x2cuMFy4h4MrTA7/CEwSsJr5HGegMnJqnzUwNfG52ufuMpJu+TbcLjVTZEWXvw zPrGzn3AeuCyN8jmZcxu4vYDW8Cz5hETDMMohjIsgHZ3A0Q8jvsmZ2hKE9H5a6xpSsip YGhZv4cU5C/PBp5gF4IIjhnP7qxAKP/uWtt3CkopkRARSynA3WtsoBpMq5AdfI4kYsEH UTYyFJ4BKMRvAElvPqRlIXeOifMDAaWy38rfzbtqYuQMwGc33sbaZOVKb4jvVfIUu2v4 oMCplRVkWIaE+3xa9723Nqs4WySSdqfHRA7ztC/6mMkJIh++B4D2vP6fCGhxsgm9h1Yv UViQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AT64JPjijrBa4KylaT1nTk9WXXduaxRTtCv2wVwy4QE=; b=PutE0TSgpJ2OG0ZVmDf60aFmtDXn7f9WyDqSU21h1oh3ZU7vkE3OadyGEm2Vyk9K29 yFgmz1ZdOG4ObkVSavrdhSRR6egBiSkHEyA3cKTkEFi7mbYcIm4E54DV93BnmdjMSHb9 A3IT3UK7ltnZNCLd2gihT4PxlGmmU2or7CTx8d8JGZqWNMYpxhQJ4yD0KmYhJaP/wsC8 vtn9tPryZ0a6VL8qCRUjQiCwUZgtk1R7P9h/TIMlLNpKMRratzdcwfnkce7VWTvXEd3y GglTbNUZR9fnEJv2tHReLL/Wx3Yvc7NPSAx+N8+7XeOKf/8MELG86b7cVlcvT0uc6p0u GhXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AUMR4H9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t3-20020a056402524300b004615fad6144si8984152edd.40.2022.10.24.01.20.39; Mon, 24 Oct 2022 01:21:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AUMR4H9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230322AbiJXIQk (ORCPT + 99 others); Mon, 24 Oct 2022 04:16:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbiJXIP7 (ORCPT ); Mon, 24 Oct 2022 04:15:59 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B29B33A09 for ; Mon, 24 Oct 2022 01:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AT64JPjijrBa4KylaT1nTk9WXXduaxRTtCv2wVwy4QE=; b=AUMR4H9IEcg/RzzXZM8nxu/B7wkhJjeznn89DdTZJlcfQcqZS96Yd/mqfMPZrmpCBDxC4y ma2PO5zcvYKT/8IwWamm4M6hnPh6Tlx+NmaI+0IyfEcBlbLtYS06zwxYVYfX57NKH+TK07 WZHORlxn96te9g6rnuYqld+OAM/nusc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-130-mSfA_UKmOI6tRH5XBi0jPw-1; Mon, 24 Oct 2022 04:14:48 -0400 X-MC-Unique: mSfA_UKmOI6tRH5XBi0jPw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADB4B3C10144; Mon, 24 Oct 2022 08:14:46 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 493A840C6F9F; Mon, 24 Oct 2022 08:14:42 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 1/8] mm/percpu: remove unused pcpu_map_extend_chunks Date: Mon, 24 Oct 2022 16:14:28 +0800 Message-Id: <20221024081435.204970-2-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556408745479753?= X-GMAIL-MSGID: =?utf-8?q?1747556408745479753?= Since commit 40064aeca35c ("percpu: replace area map allocator with bitmap"), it is unneeded. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- mm/percpu.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 27697b2429c2..26d8cd2ca323 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -174,9 +174,6 @@ static DEFINE_MUTEX(pcpu_alloc_mutex); /* chunk create/destroy, [de]pop, map ext struct list_head *pcpu_chunk_lists __ro_after_init; /* chunk list slots */ -/* chunks which need their map areas extended, protected by pcpu_lock */ -static LIST_HEAD(pcpu_map_extend_chunks); - /* * The number of empty populated pages, protected by pcpu_lock. * The reserved chunk doesn't contribute to the count. From patchwork Mon Oct 24 08:14:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318325wru; Mon, 24 Oct 2022 01:21:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fS6yknUPqih3unjjuoUsxcIIjMhi+I7joOIRy8Mwp0GLWAYTp+W1LZPZeMbh4oqZX5uRX X-Received: by 2002:a17:907:72cb:b0:793:30b3:7f89 with SMTP id du11-20020a17090772cb00b0079330b37f89mr20932727ejc.259.1666599709669; Mon, 24 Oct 2022 01:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599709; cv=none; d=google.com; s=arc-20160816; b=iBHhpsTIvEFu+hHWyeLONCqQkQcBo1TEBLcvDhuj1i/2K43Txhdc2LTrNsKX4GZMRi KLp0JBSUCdO/gku7p704gV+miqBC2iZ+wuCRLqwKoxLW6EzqmfB7hM85IcxjC1h3VNvW F55P63zuxDfHa2uj1g4Y42jbqwgG8RwbvKAu15vXr2MaGRmNWycr6ajO33EzxaJ2Www0 tDQwZxpvj+YHkevretxjovSl8Fh9MicyP++tax5ObPZ2ESFjnThWtrgzEpRd8rIRR7iJ GUwSX2AketUmPJrz9J/9jCvuWrt60WaQthBT1qKspphYkdZKkwXWV6/SDGoZjc5g9y8R Q63A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=II9JgjXmJ1/1u2CpjGXaWwKe+WW1rdQe/wCmpKMP6aM=; b=iBnPqctQfcAAvyF5pm+3FonctFkGsg1qCkaHcYKkjrSMz9dWlAGU0L5HoRN1gs1lMJ onfueoGQuj8JkI868BqWCmp2u6ZGgXjWYSRaA5y4+1vf8Ej7MTzRKT0s7Am9lgCSsjCK wtRUKVv7t8tqlsRyh2L3CnpcAJR6NE8DMW5YFNt+6nhDY71NKKyzzZcMqBiz6PHnrFpw CVlKgEmlUMbT3jJzrkafOfq0hIxAsobjDI6VZB9VijnQTT4c91yBvbEgHPSIygzCFxli TovhEmbEIg4+E0cwGqBJV015zAPXGnj4Rgg4vIznHoPVLbh/fLw+bZ2H/wMM6v6bXEVl Z8cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JgrF9Eyj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg7-20020a1709072cc700b0078e1216fb07si13917055ejc.558.2022.10.24.01.21.25; Mon, 24 Oct 2022 01:21:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JgrF9Eyj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229491AbiJXIQJ (ORCPT + 99 others); Mon, 24 Oct 2022 04:16:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbiJXIP1 (ORCPT ); Mon, 24 Oct 2022 04:15:27 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 923B83FA01 for ; Mon, 24 Oct 2022 01:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599294; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=II9JgjXmJ1/1u2CpjGXaWwKe+WW1rdQe/wCmpKMP6aM=; b=JgrF9EyjNHEJYlFJAZ32Xx6VvsLY3n8VobP5XITfLLJZmikEcJL11kJVSrtnTcT2K01il5 r06xEUWyTbtgNUBBl0QlQBsEdPCdXi9Z/9cUiB5ur5A+tzm4tIplBZ64HqcV6v95kLLZwr /zSJCa84e6AcV3FgeLOKIHg/l+N5WVg= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-465-bJGbBwAUPae4Iz-zpeIZZw-1; Mon, 24 Oct 2022 04:14:51 -0400 X-MC-Unique: bJGbBwAUPae4Iz-zpeIZZw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AC69F3C10147; Mon, 24 Oct 2022 08:14:50 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 546C940C94EB; Mon, 24 Oct 2022 08:14:47 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Date: Mon, 24 Oct 2022 16:14:29 +0800 Message-Id: <20221024081435.204970-3-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556457101901127?= X-GMAIL-MSGID: =?utf-8?q?1747556457101901127?= To replace list_empty()/list_first_entry() pair to simplify code. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- mm/percpu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 26d8cd2ca323..a3fde4ac03a4 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -2143,9 +2143,9 @@ static void pcpu_reclaim_populated(void) * other accessor is the free path which only returns area back to the * allocator not touching the populated bitmap. */ - while (!list_empty(&pcpu_chunk_lists[pcpu_to_depopulate_slot])) { - chunk = list_first_entry(&pcpu_chunk_lists[pcpu_to_depopulate_slot], - struct pcpu_chunk, list); + while (chunk = list_first_entry_or_null( + &pcpu_chunk_lists[pcpu_to_depopulate_slot], + struct pcpu_chunk, list)) { WARN_ON(chunk->immutable); /* From patchwork Mon Oct 24 08:14:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp317890wru; Mon, 24 Oct 2022 01:20:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6WQWguAInvpZFoGx8BtB76bXbvQnElj/ZLZXpnNyEcRdgJ20YPBneH7tWAUy9rqYFNgHDR X-Received: by 2002:a17:907:7f05:b0:78d:e869:f2fe with SMTP id qf5-20020a1709077f0500b0078de869f2femr25093431ejc.684.1666599625945; Mon, 24 Oct 2022 01:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599625; cv=none; d=google.com; s=arc-20160816; b=zg5rxAjNKKiwHrQKdDIAaAYhDiusvPOtHShr/78xV7ZuzYtNjG/lX0EX4jftH52oz4 Qp6WTHNO2wkArpgoEiMcqQDch2lYXt3zOlIjKwYCQrKpAGf+76v2uKummlVyb2czKP+x Ffy0vEuTEFT1c+l4sEJx6M3idLZwGNPfU3Wub/seyd/pwyg/1KIvckP9zVS3NQQdJXSq hZMgPNOgk8czUR3AKErwLtVvXMV9L2xUE2hwoWkSJPCQkszwmJKlWk7QjFB3eg1gjDfq vkcu4OiECxDIR2+1f8DV+hSsDMV+lgLCmOlQvQ06jDqVKFjAwaUjGBojxUji3cDA3mRU JAkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EBzRuKDFM+71l7c7xLrT1+dLyWIbjD2WVMOLNE3ePAk=; b=d9UTLufp3qJJINKTX9w2nRK6riYD+98MKeer9tQy3ekYTPUoCbFhQgS5LiMCN1OJUZ UbL3IpBVDcM/HP7Gdae2tPNjPnTODpLHrYrZu3SJ4fgENaiaFdjnIKmQ6t4aAGP2YGwM T2sllUvnXD0i9smi3Z8dr7cvHPOj89gniQ1E5aZIxan5mMOGlJmSrf4DLMESa+nsL1Tw otag2+UXcBhjLOk9h3+g5e+WOsXngEXIlymSnK9oWDoLtg2HEtngpbUNPsX6VmjXKd/F uA3ve7IfsiQ4qR4HZF8x40VmctG2peO/yrd8OhlwASm2vnR6PFw+X92v0kksn2Q1R/61 v+2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MnHAroaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs23-20020a1709073e9700b0078dc5e684cbsi29335210ejc.462.2022.10.24.01.20.02; Mon, 24 Oct 2022 01:20:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MnHAroaT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbiJXIQh (ORCPT + 99 others); Mon, 24 Oct 2022 04:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230313AbiJXIP6 (ORCPT ); Mon, 24 Oct 2022 04:15:58 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5E9F43313 for ; Mon, 24 Oct 2022 01:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EBzRuKDFM+71l7c7xLrT1+dLyWIbjD2WVMOLNE3ePAk=; b=MnHAroaTc6RrPXwsH+QgEgbPO/IJ4eawdOfFKdlWRoCGChSg7ldSANu9OvDV1a4FRfIBMb /4RuK75ADJukCxSS94O85pzOPrWX0aYWUUOi49Z+RrVGvSS5ZNWSqSdAtSXEJYLUzwtTfb CeqvxxJjhMwyfN4tQ2L61PHS0YmxfdQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-SP0uFmoMOeuzBev62VLccA-1; Mon, 24 Oct 2022 04:14:55 -0400 X-MC-Unique: SP0uFmoMOeuzBev62VLccA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94E3D1C05132; Mon, 24 Oct 2022 08:14:54 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F37140C6F75; Mon, 24 Oct 2022 08:14:51 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 3/8] mm/percpu: Update the code comment when creating new chunk Date: Mon, 24 Oct 2022 16:14:30 +0800 Message-Id: <20221024081435.204970-4-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556369634008953?= X-GMAIL-MSGID: =?utf-8?q?1747556369634008953?= The lock pcpu_alloc_mutex taking code has been moved to the beginning of pcpu_allo() if it's non atomic allocation. So the code comment above above pcpu_create_chunk() callsite need be updated. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- mm/percpu.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index a3fde4ac03a4..a8121302a79c 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1817,16 +1817,12 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, spin_unlock_irqrestore(&pcpu_lock, flags); - /* - * No space left. Create a new chunk. We don't want multiple - * tasks to create chunks simultaneously. Serialize and create iff - * there's still no empty chunk after grabbing the mutex. - */ if (is_atomic) { err = "atomic alloc failed, no space left"; goto fail; } + /* No space left. Create a new chunk. */ if (list_empty(&pcpu_chunk_lists[pcpu_free_slot])) { chunk = pcpu_create_chunk(pcpu_gfp); if (!chunk) { From patchwork Mon Oct 24 08:14:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318217wru; Mon, 24 Oct 2022 01:21:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4E+PBqS8pMvZByYXK8N4k18h0V9w5kuVkaVwL1xcPeddhRwRpPGgWtojyDr2B/KCsMbiEO X-Received: by 2002:a05:6402:550c:b0:443:7d15:d57f with SMTP id fi12-20020a056402550c00b004437d15d57fmr30065811edb.147.1666599683664; Mon, 24 Oct 2022 01:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599683; cv=none; d=google.com; s=arc-20160816; b=YlC/gAoN0flX/9AiIZ8HobbgM5zg1YQXPhk7eRM/5yr1byBFg2qss5r/7OxXboTfbh SINlSRpzZC26EuMKNDeoKWn6DGdfwtarhKPbOg9bfPP9fTNXUw9HIdm+dbSR+lnnzYwz qTlR4vPGiq86toCSsaE9UMmOAJ4YI3Q0QlUj5NihUebbIhs9SAuQk2Tg1gTSL2eQDoyD vUOJyenGnY0YwVBY0w9UxAe/YNYWsaJ//AT5VthCMM1eAv+GRA0vXuSpcZYc6dbYLo97 +dmigu4ae4SgBH0ct+6Tn/8pqK5GD9YFDkh9pRz6KoDvld2WKzPrsaJHH0l7sXzHodSM nxGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L+dfYrksNn4TdevHXr7sUSqhlmuSgsZD4nCKZ/IkdDk=; b=bHts1+kYOzF2RRozbDmCQ/ntMuXzvHI+GQ2vNCP2l0jP+sNc8c8gC6f7aWtdgxvawg TXNwqWWDLWL8gc4OV8pcLmMV7mY5NbolkK28/G4R2XNJACriYcd5bp7mp3EYKGn1/i7b jw8g7qDqF7hAfY5vviO1BWXJ/3Zke69jRrzIJw528UcRvyoxkOXBw7G9zoOOEbsa85/i n3UNZpGktIVkpQLRYa8jP7jkDf6AJDeaYaKw3Ju88tmMhPHBEHP2hINt2nrtDFwzu4vo qoCA1DbuotTVHF6m9+0QWSc7CN1w3mpgMQD00J//woxWhQeH9u10vgwC1/yxb3g1FGX/ XvYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cAUvlvdr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay17-20020a170906d29100b0078df40b4300si21797705ejb.53.2022.10.24.01.20.59; Mon, 24 Oct 2022 01:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cAUvlvdr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbiJXIQu (ORCPT + 99 others); Mon, 24 Oct 2022 04:16:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbiJXIQC (ORCPT ); Mon, 24 Oct 2022 04:16:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A3C4D800 for ; Mon, 24 Oct 2022 01:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L+dfYrksNn4TdevHXr7sUSqhlmuSgsZD4nCKZ/IkdDk=; b=cAUvlvdr7ErAxFrnDg3jWxpv9aR9iP+rNipsO3fUy4JQ2pDQxhIEOeTtuK8mqy7ovZWVio prdJHB2NMjLhc7Y4IlKA/DzvkA1AHxUix9LM8a5y8OXBlSmZlHXuVhcaodYYY7SqcLLMuC zzzZRENNCUDRpZ4UiC23EeKBpafZhDU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-6Bt9hgApOOS0VLkaDLvcJA-1; Mon, 24 Oct 2022 04:14:59 -0400 X-MC-Unique: 6Bt9hgApOOS0VLkaDLvcJA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED68C185A78F; Mon, 24 Oct 2022 08:14:58 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C16240C6FA0; Mon, 24 Oct 2022 08:14:54 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 4/8] mm/percpu: add comment to state the empty populated pages accounting Date: Mon, 24 Oct 2022 16:14:31 +0800 Message-Id: <20221024081435.204970-5-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556429955987012?= X-GMAIL-MSGID: =?utf-8?q?1747556429955987012?= When allocating an area from a chunk, pcpu_block_update_hint_alloc() is called to update chunk metadata, including chunk's and global nr_empty_pop_pages. However, if the allocation is not atomic, some blocks may not be populated with pages yet, while we still account it here. The number of pages will be subtracted with pcpu_chunk_populated() when populating pages. Adding code comment to make that more understandable. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- mm/percpu.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index a8121302a79c..09e407338573 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -831,13 +831,15 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off, /* * Update s_block. - * block->first_free must be updated if the allocation takes its place. - * If the allocation breaks the contig_hint, a scan is required to - * restore this hint. */ if (s_block->contig_hint == PCPU_BITMAP_BLOCK_BITS) nr_empty_pages++; + /* + * block->first_free must be updated if the allocation takes its place. + * If the allocation breaks the contig_hint, a scan is required to + * restore this hint. + */ if (s_off == s_block->first_free) s_block->first_free = find_next_zero_bit( pcpu_index_alloc_map(chunk, s_index), @@ -912,6 +914,12 @@ static void pcpu_block_update_hint_alloc(struct pcpu_chunk *chunk, int bit_off, } } + /* + * If the allocation is not atomic, some blocks may not + * be populated with pages, while we account it here. + * The number of pages will be subtracted with + * pcpu_chunk_populated() when populating pages. + */ if (nr_empty_pages) pcpu_update_empty_pages(chunk, -nr_empty_pages); From patchwork Mon Oct 24 08:14:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318332wru; Mon, 24 Oct 2022 01:21:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7sKRSZKDPFobPD19evnkLaPX3q+uy91p2ykWHODiobR0oGr7ByXHRgJ4aJGNmECZYDWJzk X-Received: by 2002:a05:6402:2687:b0:45d:3a94:348f with SMTP id w7-20020a056402268700b0045d3a94348fmr29567378edd.48.1666599711145; Mon, 24 Oct 2022 01:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599711; cv=none; d=google.com; s=arc-20160816; b=iSY+9QdCO/6tKuyIcDWjwgmhBeSVKV7Mu4Mh0VjM8Cs5Q1Hv5HzUSftCZ5Pqbdpt1E n+6ocQsqEAv2jWin4YaCqCptE0V7SC5IY0ytd8oOgBJJR1P1mUipzicoa/WoL+1HXp6d sHLa25jBJmMRQPhwAaur+ej3mmPXAf/LR8kkZ0CmJ7GY/dIXO9W0FppF7bacbMkWNLPX urMHwQJ7ItYrRae/7Ugdo7s10bnV1PNR0mt4buEqJ8fI4nLXhqKzXpJOn7DmnegHXU4+ YPoU+Wf6oxoD2tM4taWqsbaFkFbPQd1ejYeV60x9RoWDhDXqI/P0W/Dsvi83ZZwSSLn2 4MZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lMCNuRuv+p/VyO8f2sd5NbLS+a0poTkVGW4v1nMo8cA=; b=Hp8iLSVbkC7cxKxEtweIdhkypx/+5y3ZYvl8V1nr5vjW9/IwjCIIb2BFiCrb0tRWB2 shkDu0EXBmoJnnbe3+p27Oa2TUUuqxZXuVT11t78ANJTryQYyu1DsaquHhxq9SC1RPHx O2PGk15wjJ8ZWmyRYbHMNjYVdXalMPjD9MCMJwGioHOGbPQJVyoXRcULYdaqzmx+hU2F s3FeHBoNy6p952KsaWUz30kJGvvNEZINhBYcqruZR77ozOOh+jvqqQmnD0IRBbzhUHM8 qQpQcjqF+dYjnNUzskQzmoaEWX9sCGsOqvfKmcgq8yfFQCYBjMrVXQQy6OEZThY8zFWm IaPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OAPboD57; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m2-20020a1709062ac200b0078da856a4ecsi20890082eje.391.2022.10.24.01.21.27; Mon, 24 Oct 2022 01:21:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OAPboD57; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbiJXIRQ (ORCPT + 99 others); Mon, 24 Oct 2022 04:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230312AbiJXIQh (ORCPT ); Mon, 24 Oct 2022 04:16:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7488E5D0E5 for ; Mon, 24 Oct 2022 01:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lMCNuRuv+p/VyO8f2sd5NbLS+a0poTkVGW4v1nMo8cA=; b=OAPboD57Tw1rxbkMuw+eIV0yL0zgiwyjnlV8QHB36bErKTWz0F35lQku2BqYHhNgONu31Y AC8azW8mSlwIE40Ung+p5XebdtrfJTdsOj1vkPahj2zdvn8ygnZYd9DWkAIH5Eyu+sl8rU XsiAy8dGPY/Bi5ajijHvENAtUy4sJVk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-oh6QCyUQPPSLXucDD99q_w-1; Mon, 24 Oct 2022 04:15:04 -0400 X-MC-Unique: oh6QCyUQPPSLXucDD99q_w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4611181DA23; Mon, 24 Oct 2022 08:15:03 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4C4640C6F9F; Mon, 24 Oct 2022 08:14:59 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 5/8] mm/percpu: replace the goto with break Date: Mon, 24 Oct 2022 16:14:32 +0800 Message-Id: <20221024081435.204970-6-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556458502311125?= X-GMAIL-MSGID: =?utf-8?q?1747556458502311125?= In function pcpu_reclaim_populated(), the line of goto jumping is unnecessary since the label 'end_chunk' is near the end of the for loop, use break instead. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- mm/percpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 09e407338573..954abf916c7d 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -2167,7 +2167,7 @@ static void pcpu_reclaim_populated(void) /* reintegrate chunk to prevent atomic alloc failures */ if (pcpu_nr_empty_pop_pages < PCPU_EMPTY_POP_PAGES_HIGH) { reintegrate = true; - goto end_chunk; + break; } /* @@ -2203,7 +2203,6 @@ static void pcpu_reclaim_populated(void) end = -1; } -end_chunk: /* batch tlb flush per chunk to amortize cost */ if (freed_page_start < freed_page_end) { spin_unlock_irq(&pcpu_lock); From patchwork Mon Oct 24 08:14:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8227 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318786wru; Mon, 24 Oct 2022 01:23:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7bHSUZf3z1pTOqY763uA4LUmO388OheAzbyQUllfl5iZwx6fkZBNlKvcOG+4qCJUdNdCs9 X-Received: by 2002:a17:907:1ca2:b0:78d:ec49:9c2f with SMTP id nb34-20020a1709071ca200b0078dec499c2fmr26321332ejc.308.1666599825979; Mon, 24 Oct 2022 01:23:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599825; cv=none; d=google.com; s=arc-20160816; b=GLEbQmAdvEx+pIF1Wxp1A+iYeMimvCU+o+nRSIGrbyq92HKu6Y3YgmCVdBO3mXXeG7 k2ePtK7SDMMXmnH7y8lotb4TLjLTpEbnufny0gw7nWF1sxNwnVy3KGqUM1ztfkLVW0rS ypKhcG4cO2Ea3Pgh1ysVAj5WQi7Fgn4/OF2xs/Ib41ylkHvSuyMrrDN4FoXX2EX0QmqM g581CGdGDNphGiUSzQPr8bNdM6mObckT8kSHBu/wixSn+0x347N8Ej4oHor9uOeB6S4y UffPybrvMVloqTUmhMUikX/2MkoD9wMeKHL7s4RKlgvVawlTHOaMLI50vsi+2AjvuaCB rkLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g3MWDQZ+YEFLhc1+KrcZwWlcxn1kI2z+4saRqDzwGGg=; b=iNAwExjEXmN6IN1mzl0lSGxgO/0aoS7WZjhPVNTIHW3FnBYHCVZVPaIhXO4p2c10dW NWgNxqrUaLXwBmU9hAZHHyaPCvIERt3KE5IcNT5KzvB93Qi1/TFQ4odeq/23+lwllJ2A aGkLEgfL1R3NZbs48rjZDeIHed3/9uBL8taU8a1NROK3WwxD3xW+H+eSl7hRI+dwyq53 DAsb90mDvoUPi5lbDdC36KgQNk7rG2Qd5X32pu3YApnTn/VChnKpK4oURLhBPlD3oD5N G6kHizuVVsvp8sgFb3VO+UoQt4+682Zqf8tIThrogAYqXjGt9Eah78CV0eYbAwVDtjmh Y5HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NtxNg0iH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kx10-20020a170907774a00b007832270e88fsi24475763ejc.681.2022.10.24.01.23.22; Mon, 24 Oct 2022 01:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NtxNg0iH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229939AbiJXIRJ (ORCPT + 99 others); Mon, 24 Oct 2022 04:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbiJXIQ3 (ORCPT ); Mon, 24 Oct 2022 04:16:29 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 952E258169 for ; Mon, 24 Oct 2022 01:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599313; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g3MWDQZ+YEFLhc1+KrcZwWlcxn1kI2z+4saRqDzwGGg=; b=NtxNg0iHzGYBL0/u08pCAo8H38CwXaXcI/da0n/quz/rz6rEhuC33FTjAs4WiLP9Q7uvc2 UusPO2mNUOOukg2zbny3aQRKOZAeJpW9ywdf9tTFbEb9wR3bNfsSWXfzjh4xl/k+3UrmH4 pvfAvxG48RPpnnCmoE7+1fcHtldRmf8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-wHg3keIwOaOlWtfbqML-FQ-1; Mon, 24 Oct 2022 04:15:07 -0400 X-MC-Unique: wHg3keIwOaOlWtfbqML-FQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A019101A56C; Mon, 24 Oct 2022 08:15:07 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE37940C6FA0; Mon, 24 Oct 2022 08:15:03 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 6/8] mm/percpu.c: remove the lcm code since block size is fixed at page size Date: Mon, 24 Oct 2022 16:14:33 +0800 Message-Id: <20221024081435.204970-7-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556579488794977?= X-GMAIL-MSGID: =?utf-8?q?1747556579488794977?= Since commit b239f7daf553 ("percpu: set PCPU_BITMAP_BLOCK_SIZE to PAGE_SIZE"), the PCPU_BITMAP_BLOCK_SIZE has been set to page size fixedly. So the lcm code in pcpu_alloc_first_chunk() doesn't make sense any more, clean it up. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- mm/percpu.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 954abf916c7d..96191f7b61ba 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -72,7 +72,6 @@ #include #include #include -#include #include #include #include @@ -1347,7 +1346,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr, int map_size) { struct pcpu_chunk *chunk; - unsigned long aligned_addr, lcm_align; + unsigned long aligned_addr; int start_offset, offset_bits, region_size, region_bits; size_t alloc_size; @@ -1355,14 +1354,7 @@ static struct pcpu_chunk * __init pcpu_alloc_first_chunk(unsigned long tmp_addr, aligned_addr = tmp_addr & PAGE_MASK; start_offset = tmp_addr - aligned_addr; - - /* - * Align the end of the region with the LCM of PAGE_SIZE and - * PCPU_BITMAP_BLOCK_SIZE. One of these constants is a multiple of - * the other. - */ - lcm_align = lcm(PAGE_SIZE, PCPU_BITMAP_BLOCK_SIZE); - region_size = ALIGN(start_offset + map_size, lcm_align); + region_size = ALIGN(start_offset + map_size, PAGE_SIZE); /* allocate chunk */ alloc_size = struct_size(chunk, populated, From patchwork Mon Oct 24 08:14:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318512wru; Mon, 24 Oct 2022 01:22:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5+KL44UVyCmxLbShPnm6WTFEIdphmKuDlh4W6VEA1YiUcwwV9/JMtK96xmG6LaO4v3Hb/i X-Received: by 2002:a50:c387:0:b0:461:3ae6:8cdf with SMTP id h7-20020a50c387000000b004613ae68cdfmr16012960edf.131.1666599751158; Mon, 24 Oct 2022 01:22:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599751; cv=none; d=google.com; s=arc-20160816; b=Q0faK58cNW30H9LUOXsLTjgeTXAbu42gX+T0u10jYzNNWZ7AKE/RIaOZ9E20Ow96zB QR6UC28jcAf8l6bDO+l3/L31tIUBg/QFUY4TsmMzlHqNYlN3DixPm+wJnocKX/VnGh8o lQq0k2GQLKLhBxFCyGSPx7anGniwR6WuRzEC/tZpeSPCzRCfL1LdoaJm3IaFeaU5QBId eL7BpPdi+0m6zOtWsscBBnyBI3lZavvyNlYRFC6VZolLsQmVU/Lta7AYvhWU0xbJO3WQ He+O/2XDIsY80Z4XjtLzwfVdnFlFq0ULn3eyb4cIcgowAH17gisvf5r3mhwqWZ3rYmBX G0dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qhNjNie8t1+sw/Ww+09Nk0F1+B4cpGUlQfgZx8SKUOg=; b=N/tI410XPNOtaN44HBsgZ/CKys+zFvKCtk3VRCjBooEp7xIjgL9LxWriZFdUF/c6/7 Sq1dETCj3HZYsLCL1hIrMD29enlqsq9zEocPUt+sfp3tFPtJaIZJt/gDccEXS9IAQqYg gqa7BQBNpjpeaSX9FESJx0QaXjETvCa1K8AMo6sUzLQ+RxcjbgL72y0KYVQpW1sC7/kR qVXa6/iT+Uxj0VtRE7VFIDjjiWsXU1W8WmMlEHxsD4J30W7fnmyHlC81hblR7+jq6DYW cLug7oxjZoxMea4eUz3K/6nQg8kh10qEZpK9/BujctyfoghvSM+Thzx/izI0PsBMgp1Q 4PDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fBbqTS4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a50fe96000000b0045beaf03ddesi22898814edt.411.2022.10.24.01.22.07; Mon, 24 Oct 2022 01:22:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fBbqTS4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbiJXIRU (ORCPT + 99 others); Mon, 24 Oct 2022 04:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230315AbiJXIQh (ORCPT ); Mon, 24 Oct 2022 04:16:37 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE5E85EDE0 for ; Mon, 24 Oct 2022 01:15:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qhNjNie8t1+sw/Ww+09Nk0F1+B4cpGUlQfgZx8SKUOg=; b=fBbqTS4YDCDaKJjwxT6EfG/P+FLvYMvsTzpp5jGEPECZXzP7PWoo4kNrLrmJWQn7cuGtSL Q2tMnbvoRKcgs8UZa1SJUCv3zTfhoTwlf7Fii8udPLFOKSreK6QC7l0Z+xf0SXex+eesyW yxB2QWoWiQa85OmDzmk1z9TtejTzoNY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-298--o0yKi-_O3u9wnEwYSAFNQ-1; Mon, 24 Oct 2022 04:15:12 -0400 X-MC-Unique: -o0yKi-_O3u9wnEwYSAFNQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBF3285A5B6; Mon, 24 Oct 2022 08:15:11 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29F9D40C6F9F; Mon, 24 Oct 2022 08:15:07 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He Subject: [PATCH 7/8] mm/percpu: remove unused PERCPU_DYNAMIC_EARLY_SLOTS Date: Mon, 24 Oct 2022 16:14:34 +0800 Message-Id: <20221024081435.204970-8-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556500570960327?= X-GMAIL-MSGID: =?utf-8?q?1747556500570960327?= Since commit 40064aeca35c ("percpu: replace area map allocator with bitmap"), there's no place to use PERCPU_DYNAMIC_EARLY_SLOTS. So clean it up. Signed-off-by: Baoquan He Acked-by: Dennis Zhou --- include/linux/percpu.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/percpu.h b/include/linux/percpu.h index f1ec5ad1351c..70bc17db00a6 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -37,11 +37,10 @@ /* * Percpu allocator can serve percpu allocations before slab is * initialized which allows slab to depend on the percpu allocator. - * The following two parameters decide how much resource to - * preallocate for this. Keep PERCPU_DYNAMIC_RESERVE equal to or - * larger than PERCPU_DYNAMIC_EARLY_SIZE. + * The following parameter decide how much resource to preallocate + * for this. Keep PERCPU_DYNAMIC_RESERVE equal to or larger than + * PERCPU_DYNAMIC_EARLY_SIZE. */ -#define PERCPU_DYNAMIC_EARLY_SLOTS 128 #define PERCPU_DYNAMIC_EARLY_SIZE (12 << 10) /* From patchwork Mon Oct 24 08:14:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 8226 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp318600wru; Mon, 24 Oct 2022 01:23:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7KlBhTN0TMKj1ByQmom3EehIDeru+fFwBJcXOltn7n1zxqUEyy8l0sXqoAsmeba+CksYsE X-Received: by 2002:a17:907:6e18:b0:78d:b374:8989 with SMTP id sd24-20020a1709076e1800b0078db3748989mr26429020ejc.552.1666599781492; Mon, 24 Oct 2022 01:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599781; cv=none; d=google.com; s=arc-20160816; b=eIJNNgt8Azv8VcjX7BP2MCTar01cX7Oyb8SI66VABqj3KXz1hYMe2fsIwv/OJZNy6R r4oYPBE1uIjr0Zn5Hw6vlMyu2lvtm9Kt1+wea++2ABGNLoL/lWtpEWdMUAWFGwv9xIQF of+00NBrE1fUEmYpB2AAx7Kml+3/MTzW3DCfdBtt3ACOZPxR1x7Q/ZV+w2FhaYOZVub8 UyILM66svXpuP0eAlbRJE8e4HEt8aE9MK5HUJyn99jmg6gy4AXs8LruxK9o3yaEuMThw HDBWkwhRxz0hlI0gXLxzN/NmBYyPz3roycBWOys9xBlofTv7MMKITwOaIcrNo7T6xzoi K87A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oB5FHCqdQzRcpJOgYsd1zcN5d+GwusZuRHj9Ye7P85Q=; b=h2K91iQtVbNP3goiRryf2RtbnEsfR5cXvIS538vha2Jmj6t2wCRjPLba8VX3g4jW/k aLxfp2e/SahYDTm/Fsg2ZBxw5UxD3OPOucpYMYlksF4Jj82Y850lj6YXNtS6CHoK+Knq gDeV5eS6v4hrK2nuuyijp0D9BJuKW7aPQa9z8NxJZz8HR27nDtQie7Njkp2XTKJFIG2o wtvAWa4gs0PfcXUimgMjKKNB2oJIeUrsU15OR+zIPrPJoIvONMndTRgn9INgJVp/Sx9W vD8Xu91ZeT10ef+sCub6tx5f0r1GePkjeUZrSBNGyklKfg28UU88q9Cd1zRtq5BRFetu mrKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="MVVPlPV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020aa7d613000000b00461c8f80e72si1675772edr.629.2022.10.24.01.22.37; Mon, 24 Oct 2022 01:23:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="MVVPlPV/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230016AbiJXISr (ORCPT + 99 others); Mon, 24 Oct 2022 04:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiJXISM (ORCPT ); Mon, 24 Oct 2022 04:18:12 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A516E65008 for ; Mon, 24 Oct 2022 01:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666599330; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oB5FHCqdQzRcpJOgYsd1zcN5d+GwusZuRHj9Ye7P85Q=; b=MVVPlPV/zqchGBRP0L9jJ4IXX1nNCVDaaVg/AR6d6GrM6k8ReNJrJzgu59nRLD4umPcNJg Sdvk4qEZNx2AdpLs5tmLwSiaIbzCScmh/rz+B9XVM5E3adN44QTZfqoZlDkcNm6ZKgug86 L5kBwgxIK7jeeB1ZdKOPMYcpWaEpSVY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-558-md_8dzoMOzCwdktsUExyUg-1; Mon, 24 Oct 2022 04:15:20 -0400 X-MC-Unique: md_8dzoMOzCwdktsUExyUg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70B7E887400; Mon, 24 Oct 2022 08:15:19 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D63C40C6F9F; Mon, 24 Oct 2022 08:15:12 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org Cc: Dennis Zhou , Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org, Baoquan He , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH 8/8] mm/slub, percpu: correct the calculation of early percpu allocation size Date: Mon, 24 Oct 2022 16:14:35 +0800 Message-Id: <20221024081435.204970-9-bhe@redhat.com> In-Reply-To: <20221024081435.204970-1-bhe@redhat.com> References: <20221024081435.204970-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747556532866231562?= X-GMAIL-MSGID: =?utf-8?q?1747556532866231562?= SLUB allocator relies on percpu allocator to initialize its ->cpu_slab during early boot. For that, the dynamic chunk of percpu which serves the early allocation need be large enough to satisfy the kmalloc creation. However, the current BUILD_BUG_ON() in alloc_kmem_cache_cpus() doesn't consider the kmalloc array with NR_KMALLOC_TYPES length. Fix that with correct calculation. Signed-off-by: Baoquan He Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Andrew Morton Cc: Vlastimil Babka Cc: Roman Gushchin Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Acked-by: Dennis Zhou --- mm/slub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 157527d7101b..8ac3bb9a122a 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4017,7 +4017,8 @@ init_kmem_cache_node(struct kmem_cache_node *n) static inline int alloc_kmem_cache_cpus(struct kmem_cache *s) { BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE < - KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu)); + NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * + sizeof(struct kmem_cache_cpu)); /* * Must align to double word boundary for the double cmpxchg