From patchwork Wed Mar 15 19:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li zeming X-Patchwork-Id: 69267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1530837wrd; Mon, 13 Mar 2023 19:57:59 -0700 (PDT) X-Google-Smtp-Source: AK7set/IvBQ9e6WPloIKo6TbScIjIJP7GCQzqIveVKYcuji/+bZxftzzTFf3oGwe5VpxJfbN1rK5 X-Received: by 2002:a17:902:dac1:b0:19c:13d2:44c1 with SMTP id q1-20020a170902dac100b0019c13d244c1mr45570135plx.15.1678762679663; Mon, 13 Mar 2023 19:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678762679; cv=none; d=google.com; s=arc-20160816; b=X4hRdbaIADXo1UlDyjeSWt1/iZ/GESAXvwlfNDMmVh6KU8kvH26c+KPYfY+WBV3+im IdR4eZUhI9mBWnhKhPfXM11nuVJQcmQPlrkOoWnAmQ+djdZFOfQblQuNQzanCCeq7+UI eo262QdIlgUgjRvYXHJEWcoDzbYAHRtHGDZ5criiUV0BHDsAtyZ+DDX6TLlm9S49etpG SZAt35Kd1/nJnRUPWwZFNdv2V1cp9NbcrFx8j3C49VWPDDIhipSQfUNO4BO48Qv6T32Q OCg4P1eXS6XOd9CL/vpshIrxjSBzKrfobUJ6D0ipyaE3E4nW4YSHhQzB/jgI+KqemBkk gWmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=SCOVNTCYUAu8pJVBfAWtifQIsesH8+A3+akxq4DZ16M=; b=CLPn1+ITWhYMG7kDMstRLfFvu7dspcZcf+PhkF0RBbkxl/wrbvXt2VncVsQDFEX14p 1RzPBbK3ttk6HpNn5KTX1HtjwESPPMAQ6E0A9LBwjajynZJL7/qRP7l0HU9LXnm44zjJ s2Li8nbvZEEngd8V4X8H/X017BMkhzj7P/RoRmtGjl4UwcyM5BB08Unkb1dIzFhiSqTf hC6WAAMeVKsVoTHRiYKX/tcNaI+a/Kh60uXwOGByfaxS6H+H0+0pTLz93Q6te6i53oJu 7VwZ2ZPwdyLOt+QxckuEuIIa5hPcknOXocZ92zwqmKo5uAu3+Rnobo8r2wxDoPKVTrLn RyJg== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b8-20020a170903228800b001a04bde6843si1460754plh.259.2023.03.13.19.57.42; Mon, 13 Mar 2023 19:57:59 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbjCNCl2 (ORCPT + 99 others); Mon, 13 Mar 2023 22:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjCNCl0 (ORCPT ); Mon, 13 Mar 2023 22:41:26 -0400 Received: from mail.nfschina.com (unknown [42.101.60.237]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE21683890 for ; Mon, 13 Mar 2023 19:41:25 -0700 (PDT) Received: from localhost (unknown [127.0.0.1]) by mail.nfschina.com (Postfix) with ESMTP id 869141A00A24; Tue, 14 Mar 2023 10:42:16 +0800 (CST) X-Virus-Scanned: amavisd-new at nfschina.com Received: from mail.nfschina.com ([127.0.0.1]) by localhost (localhost.localdomain [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y9sF5mFJskeq; Tue, 14 Mar 2023 10:42:15 +0800 (CST) Received: from localhost.localdomain (unknown [219.141.250.2]) (Authenticated sender: zeming@nfschina.com) by mail.nfschina.com (Postfix) with ESMTPA id A8B791A0099A; Tue, 14 Mar 2023 10:42:15 +0800 (CST) From: Li zeming To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Li zeming Subject: [PATCH] mm: mempool: Optimize the mempool_create_node function Date: Thu, 16 Mar 2023 03:12:43 +0800 Message-Id: <20230315191243.3289-1-zeming@nfschina.com> X-Mailer: git-send-email 2.18.2 X-Spam-Status: No, score=2.3 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_24_48, RCVD_IN_VALIDITY_RPBL,RDNS_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** 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?1760310255363569419?= X-GMAIL-MSGID: =?utf-8?q?1760310255363569419?= The pool pointer variable gets the kzalloc_node function return value directly at definition time, which should be more concise. Signed-off-by: Li zeming --- mm/mempool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/mempool.c b/mm/mempool.c index 734bcf5afbb7..9a4db6efc9ab 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -267,9 +267,7 @@ mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn, mempool_free_t *free_fn, void *pool_data, gfp_t gfp_mask, int node_id) { - mempool_t *pool; - - pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id); + mempool_t *pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id); if (!pool) return NULL;