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=-2.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 20A97C433DF for ; Thu, 18 Jun 2020 17:25:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B1CC32184D for ; Thu, 18 Jun 2020 17:25:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jytRn0Zk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1CC32184D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DB46A8D0048; Thu, 18 Jun 2020 13:25:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D65D88D0018; Thu, 18 Jun 2020 13:25:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C549D8D0048; Thu, 18 Jun 2020 13:25:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id ABBFD8D0018 for ; Thu, 18 Jun 2020 13:25:12 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5CDB31C4B06 for ; Thu, 18 Jun 2020 17:25:12 +0000 (UTC) X-FDA: 76943008464.09.sun26_3615e1026e12 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 3811C180AD806 for ; Thu, 18 Jun 2020 17:25:12 +0000 (UTC) X-HE-Tag: sun26_3615e1026e12 X-Filterd-Recvd-Size: 4834 Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 17:25:11 +0000 (UTC) Received: by mail-lj1-f196.google.com with SMTP id q19so8256438lji.2 for ; Thu, 18 Jun 2020 10:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qDul8Qh0CB358ogHpHF9Y6TUm3gZ3Awnu5uEsfMvzXo=; b=jytRn0ZkcCvASYLtuAiqO9TmsCYp2QNKntI0YdNmcgXJwlmGLswJemHy2QXPvAcih4 pD8+g+itRn+Ctf2uJagLKgIMldVzgnPVDWJ+L3RzpwZJbpEaoEoMQlJdUpka7cimkl5K 22IRvWru1/LyN7cgSww3ZBFwkQ/c/3G8eDYLfA9Z0G0KEioP/FueqqBL4/If1LTa0yfg sWZ98NCBnDO11r9wD1v6OfoLdojloPVlkYCHi3qfjsbuekNO7zGUhmx73/aOCl7rKUJj WbAxErDCxHChAFUAwPxCPf1v9wmZS4rFAADUpxZurdyBg/vp+SEkPKmBN/QwsXYI97hZ WLGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qDul8Qh0CB358ogHpHF9Y6TUm3gZ3Awnu5uEsfMvzXo=; b=ZhkkWo0IqmxBLx9qHqDDkD7xIdWS4JM7t7lfqDzOLPK+T7gP1eW8o1GlGN7wLm+T35 drwrE/hknyidrRAUhyS2oCk4UZE9IlNlGO+6Ua18NT5fg4eM9XiJ6fVARmkyAQrBNwUq NA0QM1ieAJATcLTh0NhAReRiU13ipCeO2ptBZUGP3I/o5VzFOKNTObWvLRkLfaHEqvlq zJ/HEwdwvRsuJ8TBgHOqWa8yOXLAWoidtvDNlKs2Alo1N4sC+dH6nmMH/Xd98gqHFsVJ v+zxIY3A3njrW9mEIJDbRRkavtzLw+nKRegSRAap29trUqORgvhtwxnFIEKhFPhD4hEE LrMA== X-Gm-Message-State: AOAM531glPLwFb0a0LpKICVC2L0a+WOiFY0sPKws6vcla8OC+//WEljf HEnblUzXZQoLm76vjSqVU9Q= X-Google-Smtp-Source: ABdhPJyEksYH81Qt/PCV8lSVyrUxAJi2V+HPAy2DPTvZAwNg9dIvImJ1AnOc8JkDn8zCVvJwpRi+ug== X-Received: by 2002:a05:651c:50d:: with SMTP id o13mr3061382ljp.181.1592501110117; Thu, 18 Jun 2020 10:25:10 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id s20sm846671ljs.36.2020.06.18.10.25.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 10:25:06 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Thu, 18 Jun 2020 19:25:04 +0200 To: "Paul E. McKenney" Cc: "Uladzislau Rezki (Sony)" , LKML , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , Joel Fernandes , RCU , Oleksiy Avramchenko Subject: Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs Message-ID: <20200618172504.GA14613@pc636> References: <20200525214800.93072-1-urezki@gmail.com> <20200525214800.93072-10-urezki@gmail.com> <20200617234609.GA10087@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200617234609.GA10087@paulmck-ThinkPad-P72> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 3811C180AD806 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: > > + // Handle two first channels. > > + for (i = 0; i < FREE_N_CHANNELS; i++) { > > + for (; bkvhead[i]; bkvhead[i] = bnext) { > > + bnext = bkvhead[i]->next; > > + debug_rcu_bhead_unqueue(bkvhead[i]); > > + > > + rcu_lock_acquire(&rcu_callback_map); > > + if (i == 0) { // kmalloc() / kfree(). > > + trace_rcu_invoke_kfree_bulk_callback( > > + rcu_state.name, bkvhead[i]->nr_records, > > + bkvhead[i]->records); > > + > > + kfree_bulk(bkvhead[i]->nr_records, > > + bkvhead[i]->records); > > + } else { // vmalloc() / vfree(). > > + for (j = 0; j < bkvhead[i]->nr_records; j++) { > > + trace_rcu_invoke_kfree_callback( > > + rcu_state.name, > > + bkvhead[i]->records[j], 0); > > + > > + vfree(bkvhead[i]->records[j]); > > + } > > + } > > + rcu_lock_release(&rcu_callback_map); > > Not an emergency, but did you look into replacing this "if" statement > with an array of pointers to functions implementing the legs of the > "if" statement? If nothing else, this would greatly reduced indentation. > > > I am taking this as is, but if you have not already done so, could you > please look into this for a follow-up patch? > I do not think it makes sense, because it would require to check each pointer in the array, what can lead to many branching, i.e. "if-else" instructions. Paul, thank you to take it in! -- Vlad Rezki