From patchwork Mon Mar 30 02:32:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 11464481 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0D5A13A4 for ; Mon, 30 Mar 2020 02:33:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7DC4C20735 for ; Mon, 30 Mar 2020 02:33:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="vate42J2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7DC4C20735 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=joelfernandes.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 65CA16B0073; Sun, 29 Mar 2020 22:33:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5E26B6B0074; Sun, 29 Mar 2020 22:33:41 -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 4837A6B0075; Sun, 29 Mar 2020 22:33:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0074.hostedemail.com [216.40.44.74]) by kanga.kvack.org (Postfix) with ESMTP id 2BAD66B0073 for ; Sun, 29 Mar 2020 22:33:41 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 32220181AD0A1 for ; Mon, 30 Mar 2020 02:33:41 +0000 (UTC) X-FDA: 76650457842.04.soda59_5a5d1cdd2c004 X-Spam-Summary: 10,1,0,7152cf1d00c872b1,d41d8cd98f00b204,joel@joelfernandes.org,,RULES_HIT:41:355:379:404:541:800:960:965:966:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1541:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2693:2907:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:4321:4385:4390:4395:5007:6261:6653:6742:7514:7576:7875:8603:9592:10004:11026:11473:11658:11914:12043:12297:12517:12519:12555:12895:12986:13069:13311:13357:13894:14181:14384:14394:14721:21080:21444:21451:21627:21740:30034:30054,0,RBL:209.85.222.193:@joelfernandes.org:.lbl8.mailshell.net-66.100.201.201 62.2.0.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: soda59_5a5d1cdd2c004 X-Filterd-Recvd-Size: 5004 Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Mar 2020 02:33:40 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id x3so17537394qki.4 for ; Sun, 29 Mar 2020 19:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1STg3B4NFmryGFsVQ39Fqcyyw2zeIxUup+slIF9OxYI=; b=vate42J2T1d4IR+p4SKAXzO/ZNqN9vu8zAMaADAJJq3jsp+Q3qXkRYHGB9gcbDfR5X yby/F2W/Z8EsSL7vC7Y/dMjfPVzClbZ7BbzFi3Jo2sSZZhn4N2rwuGJ3JSjqGl3MUieF p1dapi543VOjfTBXmPigUXE+aC4dPwbPpTuwU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1STg3B4NFmryGFsVQ39Fqcyyw2zeIxUup+slIF9OxYI=; b=F0tTKS2bkMtZ9U/xYDx72CmObvJQ3bl7EjyfYbkJLuM0Bbmi0y6u4UncjdagxTd3Xp WhKLIIWmk551C4jYwDJFXaGDfK3K7nDiWdU01ImIANvLAaFv66GnI9UtInp8tYbw/89s YsAmT6Xsis966AOV7GV+IZJ/NwnhNkOvv698VwX7CcnA//qH9alF0dvSWFWUhmvSq+CL e48vquvA1amDkGDkgyxQUz4EIrnVJJCeOtv9SKTLYfhaIIPMQ6lfcnJCGWkCnaQZy2W0 Z4PiRZZ0tmW+Lyg1zZbvo9MHv3I0PQ4HDH5hO4QgLwaKcUYvFlWShXhfWFvUZxYaPpYJ bBYg== X-Gm-Message-State: ANhLgQ3Jfv9+fY4QYEHDvF61TAxypKhMInVkZh2WSTMA+VslzYA4ecxT L6oE67ga6OFohXLVVyaegDUUHg== X-Google-Smtp-Source: ADFU+vsb7u7onAWM6SNZg0kNXedSUyJKJP7iWxDcLoGW/pjia1x5QLz+6JZM6GIVlbH8uur2r+xlOA== X-Received: by 2002:a37:6357:: with SMTP id x84mr10162791qkb.490.1585535619962; Sun, 29 Mar 2020 19:33:39 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id q15sm10030625qtj.83.2020.03.29.19.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2020 19:33:39 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Uladzislau Rezki (Sony)" , Boqun Feng , Joel Fernandes , Andrew Morton , Ingo Molnar , Josh Triplett , Lai Jiangshan , linux-mm@kvack.org, Mathieu Desnoyers , "Paul E. McKenney" , "Rafael J. Wysocki" , rcu@vger.kernel.org, Steven Rostedt Subject: [PATCH 09/18] rcu/tree: Simplify KFREE_BULK_MAX_ENTR macro Date: Sun, 29 Mar 2020 22:32:39 -0400 Message-Id: <20200330023248.164994-10-joel@joelfernandes.org> X-Mailer: git-send-email 2.26.0.rc2.310.g2932bb562d-goog In-Reply-To: <20200330023248.164994-1-joel@joelfernandes.org> References: <20200330023248.164994-1-joel@joelfernandes.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: From: "Uladzislau Rezki (Sony)" We can simplify KFREE_BULK_MAX_ENTR macro and get rid of magic numbers which were used to make the structure to be exactly one page. Suggested-by: Boqun Feng Reviewed-by: Joel Fernandes (Google) Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Joel Fernandes (Google) --- kernel/rcu/tree.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8dfa4b32e4d00..cfe456e68c644 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2807,13 +2807,6 @@ EXPORT_SYMBOL_GPL(call_rcu); #define KFREE_DRAIN_JIFFIES (HZ / 50) #define KFREE_N_BATCHES 2 -/* - * This macro defines how many entries the "records" array - * will contain. It is based on the fact that the size of - * kfree_rcu_bulk_data structure becomes exactly one page. - */ -#define KFREE_BULK_MAX_ENTR ((PAGE_SIZE / sizeof(void *)) - 3) - /** * struct kfree_rcu_bulk_data - single block to store kfree_rcu() pointers * @nr_records: Number of active pointers in the array @@ -2827,6 +2820,14 @@ struct kfree_rcu_bulk_data { struct kfree_rcu_bulk_data *next; }; +/* + * This macro defines how many entries the "records" array + * will contain. It is based on the fact that the size of + * kfree_rcu_bulk_data structure becomes exactly one page. + */ +#define KFREE_BULK_MAX_ENTR \ + ((PAGE_SIZE - sizeof(struct kfree_rcu_bulk_data)) / sizeof(void *)) + /** * struct kfree_rcu_cpu_work - single batch of kfree_rcu() requests * @rcu_work: Let queue_rcu_work() invoke workqueue handler after grace period