Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6454586rwi; Mon, 24 Oct 2022 01:22:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iOc5XGVUBoQR9GeGRAhFx3aaRp1vEigKFnWwNcWS+Cq9G6YxeOrD4uYAtf4L0YPyrJF9N X-Received: by 2002:a17:906:730e:b0:78d:94ab:77c2 with SMTP id di14-20020a170906730e00b0078d94ab77c2mr26478684ejc.639.1666599758907; Mon, 24 Oct 2022 01:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666599758; cv=none; d=google.com; s=arc-20160816; b=hSRsIrVPY5eG8KpNRE2PoWnacQssb6AZ+Sk0JbBWk+VmGFz3UrJ+XrvuPXRqzFm3gh iJTpAMGgcHrNLfPx9u3HJ/VSLvU1VO/OyNVFIRJ2/j+/xawSdsquULvsZRQkGoxHcyD9 TlJSHEJdeZxbjvgVCKM7faF9wH73U9hgNPhDdSyEWh0nrjTTtsJXenWUXSWaRixJa1MB 8rbWhXdFkyNChCbyveiqV/aaJOg4H2zGf8Y5P+CFsMbKMIGCTZcTCWjG/xP4B53gNhH7 1qZtHL+eeebPBmxfDSCj9r1TrJ7I2ibfYuPnWDJCiXs/i4BuBUQnTaWQ8N7J+Ag16dK4 WcSg== 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 Return-Path: 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.22.14; Mon, 24 Oct 2022 01:22:38 -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 Content-Transfer-Encoding: 8bit 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 To replace list_empty()/list_first_entry() pair to simplify code. Signed-off-by: Baoquan He --- 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); /* -- 2.34.1