Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp80459imu; Wed, 7 Nov 2018 21:12:57 -0800 (PST) X-Google-Smtp-Source: AJdET5eL1jBgpm8BkS32Cva7UaMNst2xyyMTg5IHUM8aJEJaxPEzKWvnVHoRe4Ia2j2v+hfBbNKE X-Received: by 2002:a63:f710:: with SMTP id x16mr2713558pgh.322.1541653977799; Wed, 07 Nov 2018 21:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541653977; cv=none; d=google.com; s=arc-20160816; b=u68813dQwoi1agliasDtXfml9++LQJ5lvHDevDPnifA2w44Xj8ivKfYC33fziKPDdS 8Fx2D45UU0jD+6pYGSSxgKHKr1QaqkSHn9rUeYw3SdR/r9Z8tbebEP/1DPTr3Hm3f3k0 i7u1nTFIR9j7zp7MQXKvtlBpOcpTgVPf251ZYHz6wjTeRjrXrlS6S4SXWJuA/XvzeAGh jhOIZ+b30VCYp0CPRuhigEo2QQm1FN0LyJ7jgV82+sdm+5aGl2/7S//xxgWHiALODsNk RhH0O9dg3tS33wWAh2Mm0TP5D4f1bUYReA4R0i6JhR7Qv5Mmjnv3V7W3XgYyG05YtB5x WzNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=MZB59JpBDhrmR42fPuwBUxrynZY/7hCJo4FxL4rGeaE=; b=OsiXdbVvWPlahHXOuY0H62T0pnZtzBV7lyfE9uevPCHOB9M11H47JXCLxGUZvbyazf aUBqFEeUvWVNNMfvvbeCd+OTHefyPbRvDuWEpbIK4VMNPJ4i6mfLYokSUXNpCgmEXCoO W1S3dUDk76xuSeoxhJZIb0EPychMHNRU+5WQl6MxZ3PFXaz4B1HwUto3zWe81HRkfa/E NdHyQ9OkRnKLkL5vbF9+LzSp4vnSzh52GPzvIDQJRI+ketueTWE/J32WVaAb0PKj2gYw xecShY3MleIV8yCDdBM30JDDcorH+Mdm9zOFPQa0o29YHhOJnb4XHdSmmmqvDVlt8j1r 5DRw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si697630pgh.565.2018.11.07.21.12.42; Wed, 07 Nov 2018 21:12:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728930AbeKHOoG (ORCPT + 99 others); Thu, 8 Nov 2018 09:44:06 -0500 Received: from smtp2.provo.novell.com ([137.65.250.81]:45010 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbeKHOoG (ORCPT ); Thu, 8 Nov 2018 09:44:06 -0500 Received: from linux-r8p5.suse.de (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (TLS encrypted); Wed, 07 Nov 2018 22:10:17 -0700 From: Davidlohr Bueso To: akpm@linux-foundation.org Cc: jbaron@akamai.com, viro@zeniv.linux.org.uk, dave@stgolabs.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: [PATCH 1/6] fs/epoll: remove max_nests argument from ep_call_nested() Date: Wed, 7 Nov 2018 21:10:01 -0800 Message-Id: <20181108051006.18751-2-dave@stgolabs.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181108051006.18751-1-dave@stgolabs.net> References: <20181108051006.18751-1-dave@stgolabs.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All callers pass the EP_MAX_NESTS constant already, so lets simplify this a tad and get rid of the redundant parameter for nested eventpolls. Signed-off-by: Davidlohr Bueso --- fs/eventpoll.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 42bbe6824b4b..7ad020f1353b 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -471,7 +471,6 @@ static inline void ep_set_busy_poll_napi_id(struct epitem *epi) * no re-entered. * * @ncalls: Pointer to the nested_calls structure to be used for this call. - * @max_nests: Maximum number of allowed nesting calls. * @nproc: Nested call core function pointer. * @priv: Opaque data to be passed to the @nproc callback. * @cookie: Cookie to be used to identify this nested call. @@ -480,7 +479,7 @@ static inline void ep_set_busy_poll_napi_id(struct epitem *epi) * Returns: Returns the code returned by the @nproc callback, or -1 if * the maximum recursion limit has been exceeded. */ -static int ep_call_nested(struct nested_calls *ncalls, int max_nests, +static int ep_call_nested(struct nested_calls *ncalls, int (*nproc)(void *, void *, int), void *priv, void *cookie, void *ctx) { @@ -499,7 +498,7 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests, */ list_for_each_entry(tncur, lsthead, llink) { if (tncur->ctx == ctx && - (tncur->cookie == cookie || ++call_nests > max_nests)) { + (tncur->cookie == cookie || ++call_nests > EP_MAX_NESTS)) { /* * Ops ... loop detected or maximum nest level reached. * We abort this wake by breaking the cycle itself. @@ -573,7 +572,7 @@ static void ep_poll_safewake(wait_queue_head_t *wq) { int this_cpu = get_cpu(); - ep_call_nested(&poll_safewake_ncalls, EP_MAX_NESTS, + ep_call_nested(&poll_safewake_ncalls, ep_poll_wakeup_proc, NULL, wq, (void *) (long) this_cpu); put_cpu(); @@ -1333,7 +1332,6 @@ static int reverse_path_check_proc(void *priv, void *cookie, int call_nests) } } else { error = ep_call_nested(&poll_loop_ncalls, - EP_MAX_NESTS, reverse_path_check_proc, child_file, child_file, current); @@ -1367,7 +1365,7 @@ static int reverse_path_check(void) /* let's call this for all tfiles */ list_for_each_entry(current_file, &tfile_check_list, f_tfile_llink) { path_count_init(); - error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, + error = ep_call_nested(&poll_loop_ncalls, reverse_path_check_proc, current_file, current_file, current); if (error) @@ -1876,7 +1874,7 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) ep_tovisit = epi->ffd.file->private_data; if (ep_tovisit->visited) continue; - error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, + error = ep_call_nested(&poll_loop_ncalls, ep_loop_check_proc, epi->ffd.file, ep_tovisit, current); if (error != 0) @@ -1916,7 +1914,7 @@ static int ep_loop_check(struct eventpoll *ep, struct file *file) int ret; struct eventpoll *ep_cur, *ep_next; - ret = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, + ret = ep_call_nested(&poll_loop_ncalls, ep_loop_check_proc, file, ep, current); /* clear visited list */ list_for_each_entry_safe(ep_cur, ep_next, &visited_list, -- 2.16.4