Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10219695rwp; Thu, 20 Jul 2023 17:05:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFtLOaXkfd2dJjgv28JdwkrcBg6Iqx6kF8N3YPfHlDhIpqUWL4mk2zxHNY99lfdMNH4Hc+8 X-Received: by 2002:a05:6512:328d:b0:4fb:9050:1d92 with SMTP id p13-20020a056512328d00b004fb90501d92mr138256lfe.51.1689897927909; Thu, 20 Jul 2023 17:05:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689897927; cv=none; d=google.com; s=arc-20160816; b=RpTN0s4JadTxEevsBkMGtuwfj7AO8JLRGOD68gIgQh7A3CjyVwHweWu1Ql4fXUU28T lbkx/VayJFHFXkRMkGVTFRGvNWtrW75wLqOagQMBrRSGfp3ZjB2CB8Vtjemh5eovxJn1 y4cFUvpm1Dw5ADY71uLBf/OktIy2j5eCf/qENN6R1xC+Qg8tDVM1pB+99L+BXKz/7y/J EP2HY65FLdH3Bb49ieapK7GWJddlD65J26iqbzrQSrrXXycb0ULPZAzx+1ZjPkSZsVnZ pVF5osPYM/d4bca2H+WbhZ24KS4upnJLgCv87bZTaXNM+xQs9S27TPDrznM0AZfuG5ZB BWLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qcWYhPUx1OxTKdJoZ4TFTmi7V95A65ppmXd4UUqPNwI=; fh=LSa0WwNx9gIVfuSDi8ukKDntK2Ac3qODk4amvFlOUGE=; b=Wtks7dJ+NW19ZSIsmBCld/H9vrlYHA4F7vlM7pjaNXmqLM3gnoZaeZ6Eao1TGF82YD 0aq5/M2dap44+iPTWL3+rOblVI5gOHc+WT8hf9Pb434ncopBDANHwpBXsmNY89In2ZgB RHyN127w77k7Rj+r8V89JfdED+KT1XGoPHz6OI16Q8/i04DLg+0sPoFWC18vqSyj+3BU 5eEmZeldzTdNhBJtBbLKAiMfKCW0UryVMzXPV0F9SjkV2Lf8BFCVkQRuPOkt6izkQ1aM c1A0FoO/t7CMAqRqC3zSbrR75lSgNW9rmX5ywJlv9o/bTPUoBPsvcCjJkM8OZCdycLWE pRrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XSvOUbA0; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j11-20020aa7c0cb000000b0051fef304630si1650686edp.390.2023.07.20.17.05.03; Thu, 20 Jul 2023 17:05:27 -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=XSvOUbA0; 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 S229805AbjGTXoJ (ORCPT + 99 others); Thu, 20 Jul 2023 19:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjGTXoI (ORCPT ); Thu, 20 Jul 2023 19:44:08 -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 C94E410A for ; Thu, 20 Jul 2023 16:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689896600; 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: in-reply-to:in-reply-to:references:references; bh=qcWYhPUx1OxTKdJoZ4TFTmi7V95A65ppmXd4UUqPNwI=; b=XSvOUbA0ErvGTvPgdt6xPAlBhZie8oLEtiWo9mfSQsVr7L+XQKwA8M5318IdrqY2xTxxqS SrJhHQe4/Mnt8R9HVdaRZyoSl1S1t7AfHrwIZWI6QJ2vOY+WKqmFIu2DG6WLdBGrf74LtT 52TFThyatOhExqCB45DX2SJyrKBN5og= Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-352-ApuzmyMUNXaSyBW43ZtX4w-1; Thu, 20 Jul 2023 19:43:15 -0400 X-MC-Unique: ApuzmyMUNXaSyBW43ZtX4w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EDCFD2800E83; Thu, 20 Jul 2023 23:43:13 +0000 (UTC) Received: from localhost (ovpn-12-18.pek2.redhat.com [10.72.12.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E899F40C206F; Thu, 20 Jul 2023 23:43:12 +0000 (UTC) Date: Fri, 21 Jul 2023 07:43:09 +0800 From: Baoquan He To: Andrew Morton Cc: sunran001@208suo.com, dennis@kernel.org, tj@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/percpu.c: change GFP_KERNEL to GFP_ATOMIC Message-ID: References: <20230718063328.16140-1-xujianghui@cdjrlc.com> <7aa3a1cee63518cb13906d11ea130c9c@208suo.com> <20230718101735.aa31791899e2f9e19e8e0a75@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230718101735.aa31791899e2f9e19e8e0a75@linux-foundation.org> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 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_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 On 07/18/23 at 10:17am, Andrew Morton wrote: > On Tue, 18 Jul 2023 14:35:11 +0800 sunran001@208suo.com wrote: > > > ERROR: function pcpu_balance_populated called on line 2238 inside lock > > on line 2234 but uses GFP_KERNEL > > > > Generated by: scripts/coccinelle/locks/call_kern.cocci > > > > ... > > > > --- a/mm/percpu.c > > +++ b/mm/percpu.c > > @@ -2033,7 +2033,7 @@ static void pcpu_balance_free(bool empty_only) > > static void pcpu_balance_populated(void) > > { > > /* gfp flags passed to underlying allocators */ > > - const gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN; > > + const gfp_t gfp = GFP_ATOMIC | __GFP_NORETRY | __GFP_NOWARN; > > struct pcpu_chunk *chunk; > > int slot, nr_to_pop, ret; > > I don't believe this warning is correct. Yeah, the warning is false positive. It releases the lock when requesting memory allocation, then take the lock again. > > spin_unlock_irq(&pcpu_lock); > ret = pcpu_populate_chunk(chunk, rs, rs + nr, gfp); > cond_resched(); > spin_lock_irq(&pcpu_lock); >