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) {