From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 951F0C433E0 for ; Fri, 7 Aug 2020 12:53:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 563CF20866 for ; Fri, 7 Aug 2020 12:53:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QxPzJSsS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 563CF20866 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C18838D00A1; Fri, 7 Aug 2020 08:53:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BC8C48D0097; Fri, 7 Aug 2020 08:53:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ADE3A8D00A1; Fri, 7 Aug 2020 08:53:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 967428D0097 for ; Fri, 7 Aug 2020 08:53:38 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B334E3622 for ; Fri, 7 Aug 2020 12:53:37 +0000 (UTC) X-FDA: 77123764074.22.comb79_260511e26fc0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 5085318038E67 for ; Fri, 7 Aug 2020 12:53:37 +0000 (UTC) X-HE-Tag: comb79_260511e26fc0 X-Filterd-Recvd-Size: 3297 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Aug 2020 12:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596804815; 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=VWhoxI+xwZ03QCZkTxfCmHgWyAvOMiqULGB6In4p2DU=; b=QxPzJSsSi7GeSK1cliKgEorpARL273EeLORt53R2RxCHZAgoNsmO0mT879jLXd+3c12Lza 6FWDxriHuf559KP5IvVKpfAOpThjCXWnrLw864N2ilA0N6eg3QREXr+DZV2tcY09nZcwhK h+o0LL1dV6ovU2q4BxkrkShnUsVN9BE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-65-LCW4CS3DNJCeMDx-LZicVA-1; Fri, 07 Aug 2020 08:53:33 -0400 X-MC-Unique: LCW4CS3DNJCeMDx-LZicVA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 861798064AB; Fri, 7 Aug 2020 12:53:32 +0000 (UTC) Received: from localhost (ovpn-12-31.pek2.redhat.com [10.72.12.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BB1C8380; Fri, 7 Aug 2020 12:53:30 +0000 (UTC) Date: Fri, 7 Aug 2020 20:53:27 +0800 From: Baoquan He To: Wei Yang Cc: mike.kravetz@oracle.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/10] mm/hugetlb: use list_splice to merge two list at once Message-ID: <20200807125327.GN14854@MiWiFi-R3L-srv> References: <20200807091251.12129-1-richard.weiyang@linux.alibaba.com> <20200807091251.12129-4-richard.weiyang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807091251.12129-4-richard.weiyang@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Rspamd-Queue-Id: 5085318038E67 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 08/07/20 at 05:12pm, Wei Yang wrote: > Instead of add allocated file_region one by one to region_cache, we > could use list_splice to merge two list at once. > > Also we know the number of entries in the list, increase the number > directly. > > Signed-off-by: Wei Yang > --- > mm/hugetlb.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 0a2f3851b828..929256c130f9 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -443,11 +443,8 @@ static int allocate_file_region_entries(struct resv_map *resv, > > spin_lock(&resv->lock); > > - list_for_each_entry_safe(rg, trg, &allocated_regions, link) { > - list_del(&rg->link); > - list_add(&rg->link, &resv->region_cache); > - resv->region_cache_count++; > - } > + list_splice(&allocated_regions, &resv->region_cache); > + resv->region_cache_count += to_allocate; Looks good to me. Reviewed-by: Baoquan He > } > > return 0; > -- > 2.20.1 (Apple Git-117) > >