Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7354306rwi; Mon, 24 Oct 2022 13:26:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77eHIQ9epBBKeNkfQv/49oCe1uo8/cK4eQBK5tt/QjZoEYi3ux2VJpRs8kMBHqz+iLrCIb X-Received: by 2002:a17:907:9491:b0:7a1:8372:5307 with SMTP id dm17-20020a170907949100b007a183725307mr10948466ejc.319.1666643172428; Mon, 24 Oct 2022 13:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666643172; cv=none; d=google.com; s=arc-20160816; b=sJrUixsMO4T+PJxo5fWryf2uPWO2gbWENeMsJWTyPT7X0ZzZhCQ7qjU4wArFM/pQoS 0afCBS2oVXFfc6lcsDnxlN4+R9NWGSW0BQgdRsGw8BJYSeu2r6q0LUvp6h6blB5vxkQ/ LoHm+/ulL/v1rKzmFQeWoWiCwXtq8lBoUktWjKJEpGD0lXtkU9VuxJd/OZESqM1O2Hqi gXn0rw4BCb3hXrKbaz5vhW/n0LJ2+ozGFUrPX+nGMUX3pc/bItw2s7QWeCoXC0HJIrvW w7lyCCSWXQy8Zb444QNBtA6WckWjxYCkZTw4u7+L+onX0jSOsodQQw396RaqzdFtNvOE 3kSQ== 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; bh=VmgpA6OkYsLwdfzsxv2INipi2Xj6qCgSNWdLB1yHrm8=; b=jwIrco0cjvy5fFmkoK7xyVQz73Y1h3mR8PtEt4ssq63B2v4VUMZVf7XU2gnMKdYaUY YsDIrKo1ntwdEqELrsi3sktly/ej9Nt542XLxWIWyvVLnu7WM/hK20/AMTtRGnKqaZCy U3xbdawVzqrEsWK5l3+pQXJCHC81yTl+4ycrN3Me32GDB7V55CjAjgCoRrJGpr+PGz/L N/phk0UJaJZeML3awsFe49oF8fLjzoKgTIyYN5EFFWzXERVj9C4Ys8ItMVAIvbnt1kky z4O0/M5yrRfl5dCLGXQGOzyXCaCxnaDBlKjRp/y0B9YZncf8mMmeg6fVs43cxtQOVH2g mfUg== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i17-20020a0564020f1100b004608c0b9a8asi726805eda.201.2022.10.24.13.25.47; Mon, 24 Oct 2022 13:26:12 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230487AbiJXThI (ORCPT + 99 others); Mon, 24 Oct 2022 15:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233290AbiJXTgs (ORCPT ); Mon, 24 Oct 2022 15:36:48 -0400 Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B97B725F1FA for ; Mon, 24 Oct 2022 11:07:12 -0700 (PDT) Received: by mail-vs1-f51.google.com with SMTP id o5so7148111vsc.0 for ; Mon, 24 Oct 2022 11:07:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VmgpA6OkYsLwdfzsxv2INipi2Xj6qCgSNWdLB1yHrm8=; b=GzQbmmihBzDcDxjXSiTOOF1YCmxuBN0aXArUTu1eQqoT5TD2HuIXsr+aRpJYa6dQsM pfNITA0qoNrLvaVN/15avPKampqKLz1namQI6A8J3W2pFxY63L8mutjEw5smKO1nSGz2 FUXcg3HqqSALB3Efp2E5ftyETaQwEa/XPKE8YJMuYijN3ejUnzKQd5SqvaUtVBS3eLua 5r7TT5/dujQs1/U620Gs0HV5q0RkwOYUQDz0HJvQamnwv/0aXVmIW732yBvcAL/YTvj8 g7nvPQgnS+iPm2bYh3rn62joujKhoiZpeFUfqHbuogwZ7Gzf6Yzf2k2pTUkuMFINUKJn GPsQ== X-Gm-Message-State: ACrzQf3sw/5ySgz9AJ3JhNMsTjShI5bfCmFdjNJBUFnBIPMjC811gzt3 WejxWf8COn9u88zfBhhaLD791FG6Z0w= X-Received: by 2002:a17:903:230b:b0:186:6041:51bf with SMTP id d11-20020a170903230b00b00186604151bfmr23671890plh.24.1666630382267; Mon, 24 Oct 2022 09:53:02 -0700 (PDT) Received: from fedora (136-24-99-118.cab.webpass.net. [136.24.99.118]) by smtp.gmail.com with ESMTPSA id ix21-20020a170902f81500b00186aaf1644asm1251plb.87.2022.10.24.09.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Oct 2022 09:53:01 -0700 (PDT) Date: Mon, 24 Oct 2022 09:52:59 -0700 From: Dennis Zhou To: Baoquan He Cc: linux-kernel@vger.kernel.org, Tejun Heo , Christoph Lameter , Andrew Morton , linux-mm@kvack.org Subject: Re: [PATCH 2/8] mm/percpu: use list_first_entry_or_null in pcpu_reclaim_populated() Message-ID: References: <20221024081435.204970-1-bhe@redhat.com> <20221024081435.204970-3-bhe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221024081435.204970-3-bhe@redhat.com> X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no 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 Mon, Oct 24, 2022 at 04:14:29PM +0800, Baoquan He wrote: > 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 > With added parenthesis, Acked-by: Dennis Zhou Thanks, Dennis