From patchwork Tue Jul 3 14:52:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10504235 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C84C1602BC for ; Tue, 3 Jul 2018 14:52:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B895828C5D for ; Tue, 3 Jul 2018 14:52:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC62628C6C; Tue, 3 Jul 2018 14:52:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CF9B28C5D for ; Tue, 3 Jul 2018 14:52:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 594A66B000C; Tue, 3 Jul 2018 10:52:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 545946B000D; Tue, 3 Jul 2018 10:52:55 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40F206B000E; Tue, 3 Jul 2018 10:52:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f200.google.com (mail-wr0-f200.google.com [209.85.128.200]) by kanga.kvack.org (Postfix) with ESMTP id DA8236B000C for ; Tue, 3 Jul 2018 10:52:54 -0400 (EDT) Received: by mail-wr0-f200.google.com with SMTP id x6-v6so1104212wrl.6 for ; Tue, 03 Jul 2018 07:52:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=pPd8F2t7hZgYFbuhXWGd3t1/0j5FIGvadLyKwn8Mwvc=; b=IoyLx8kjAvs2kFXlDJe9IR/yBh40qRELlo4BGKjOKfMShcCVJ43iptRTNz3Y5+pQbP nYFFiw3bZUuCGyLrutDVkXWsGYAlMcGBuPpWq9071vf7luoRYBGYCwUyiRWh5frGlEgi aHnirFNW4+HRDCAREE5UJl16r4gtWO3jrphJqxO1Vj0ISWeLff7TL/lj2Ln1Xzk2yJ+L vACOVismgva4Mc2z/u/zp+HDleAufgh8KUvR+r7HhM2t3mgFxRmC5deK1OYdPSJtlmz3 QUdmR9lKLAZ+L3AOyujmYZd9o14jka8M8I83FUd6n8FiLBYLv2rcVxMl7AeBiW27DIQU UKog== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-Gm-Message-State: APt69E2RqYZZA/iNs7zX5nwFgx62hbnP1qkjtvOJthDouVwUXNlzWkm7 aMJkPZkre0bbboyVc0lv5jFW/pm9XraosRCRKEVmpqEOPj6JMmjDPLOnb1ijzM85fD3+y9ddfAs IkLHDUrjS7iqQD0Wqj0ZQheW/xAyuQRO84V2+nPPiRmeWjzVfCrYXM36/56m71OHzcQ== X-Received: by 2002:adf:e50f:: with SMTP id j15-v6mr12534006wrm.111.1530629574446; Tue, 03 Jul 2018 07:52:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfUoqc7XtNf5xGAo7dGgZoZKN311sImRWRKOAU4U7iq0/Xf6SACj2XNZVcsAkf9DwulyvWc X-Received: by 2002:adf:e50f:: with SMTP id j15-v6mr12533939wrm.111.1530629573131; Tue, 03 Jul 2018 07:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530629573; cv=none; d=google.com; s=arc-20160816; b=XGlhQU8eLyiPdCexH3HawFpu0V/SbbcHqtQYkfk19ULB8wx8gqkGzM7xtkGR4ZPG6q HFWNSCClhfsDAkb6yweqIroy/Ep1RAoG2eG5b+O0sbB2g7PpsWZtU/EqtB6xTlJkZIo6 gsZ9DQc7HC1oD04mU9NoU4eFuqNwWsXgTh7WxMquv8s0+HTxqru0MOD/DnxwFR1g/2lv TNLLI0dB/exlTev3eXoECWBS5GrsMmCtvkdC3CpY47YcFSumW8J/Kf2CMNdDIJrPFqzR bOhrUhZXeakZHh0xEEuJ6gbNQHaUAfyRBl1VyX30Gy1VhZHDOJqtfXBTwYAsMSbpJbh2 XrPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=pPd8F2t7hZgYFbuhXWGd3t1/0j5FIGvadLyKwn8Mwvc=; b=wkzKunQZ4CBiaZUyUyD6i8buNpdrAI0ThZMli+0xKZ6a27grXB6r3u8h06TCqzm3dU kuJ+49i7xiVhFAmPKF6oZMpnHQlYZZYpTScxlriHGY7tZTPbavxOIJsBfoMcSyIiJIlZ mrLkgGEyfN+ZOTfrfaYQq+wbzmbCOZ5jYVj6n4tJX4oV50BuVxrlXkKJ17dR7Yy6mLsc 3xMMaOmT9HdUkdWrAsEIRZGCFbWeymIBE0JlPzEn4tcnIYEsMoWn3UoXu2HAMWGat+Bo ClgO54Z+NyfjhOZThXQRJTe/vRm2JTZmnFIXz1pyPKVgaISm5b5T/lH/1/Mjv5/Atu8Q VRQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id n191-v6si795371wmb.89.2018.07.03.07.52.52 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 03 Jul 2018 07:52:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1faMfj-000384-MJ; Tue, 03 Jul 2018 16:52:51 +0200 From: Sebastian Andrzej Siewior To: Vladimir Davydov Cc: linux-mm@kvack.org, tglx@linutronix.de, Andrew Morton , Sebastian Andrzej Siewior Subject: [PATCH 3/4] mm/list_lru: Pass struct list_lru_node as an argument __list_lru_walk_one() Date: Tue, 3 Jul 2018 16:52:34 +0200 Message-Id: <20180703145235.28050-4-bigeasy@linutronix.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180703145235.28050-1-bigeasy@linutronix.de> References: <20180624200907.ufjxk6l2biz6xcm2@esperanza> <20180703145235.28050-1-bigeasy@linutronix.de> Reply-To: "[PATCH 0/4]"@kvack.org, "mm/list_lru:add"@kvack.org, list_lru_shrink_walk_irq@kvack.org, and@kvack.org (), use@kvack.org, it@kvack.org MIME-Version: 1.0 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: X-Virus-Scanned: ClamAV using ClamSMTP __list_lru_walk_one() is invoked with struct list_lru *lru, int nid as the first two argument. Those two are only used to retrieve struct list_lru_node. Since this is already done by the caller of the function for the locking, we can pass struct list_lru_node directly and avoid the dance around it. Signed-off-by: Sebastian Andrzej Siewior --- mm/list_lru.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/list_lru.c b/mm/list_lru.c index 819e0595303e..4d7f981e6144 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -194,12 +194,11 @@ unsigned long list_lru_count_node(struct list_lru *lru, int nid) EXPORT_SYMBOL_GPL(list_lru_count_node); static unsigned long -__list_lru_walk_one(struct list_lru *lru, int nid, int memcg_idx, +__list_lru_walk_one(struct list_lru_node *nlru, int memcg_idx, list_lru_walk_cb isolate, void *cb_arg, unsigned long *nr_to_walk) { - struct list_lru_node *nlru = &lru->node[nid]; struct list_lru_one *l; struct list_head *item, *n; unsigned long isolated = 0; @@ -261,8 +260,8 @@ list_lru_walk_one(struct list_lru *lru, int nid, struct mem_cgroup *memcg, unsigned long ret; spin_lock(&nlru->lock); - ret = __list_lru_walk_one(lru, nid, memcg_cache_id(memcg), - isolate, cb_arg, nr_to_walk); + ret = __list_lru_walk_one(nlru, memcg_cache_id(memcg), isolate, cb_arg, + nr_to_walk); spin_unlock(&nlru->lock); return ret; } @@ -282,8 +281,9 @@ unsigned long list_lru_walk_node(struct list_lru *lru, int nid, struct list_lru_node *nlru = &lru->node[nid]; spin_lock(&nlru->lock); - isolated += __list_lru_walk_one(lru, nid, memcg_idx, - isolate, cb_arg, nr_to_walk); + isolated += __list_lru_walk_one(nlru, memcg_idx, + isolate, cb_arg, + nr_to_walk); spin_unlock(&nlru->lock); if (*nr_to_walk <= 0)