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 5C382C433E0 for ; Thu, 18 Jun 2020 17:30:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2209320786 for ; Thu, 18 Jun 2020 17:30:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bX0kTC4l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2209320786 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 7E6C98D0049; Thu, 18 Jun 2020 13:30:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76FF88D0018; Thu, 18 Jun 2020 13:30:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 638478D0049; Thu, 18 Jun 2020 13:30:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id 40A958D0018 for ; Thu, 18 Jun 2020 13:30:55 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id ED9D51D5B49 for ; Thu, 18 Jun 2020 17:30:54 +0000 (UTC) X-FDA: 76943022828.30.drop23_261637726e12 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id B519D1867B05A for ; Thu, 18 Jun 2020 17:30:54 +0000 (UTC) X-HE-Tag: drop23_261637726e12 X-Filterd-Recvd-Size: 4911 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 17:30:54 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id a9so8248228ljn.6 for ; Thu, 18 Jun 2020 10:30:54 -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=LLjHIli70RtnXlTI4EfBB8zQjRqR6fYYQyFR1XCt3TI=; b=bX0kTC4lkS2aDFGGfAbSxQf8k+8W6lxo9zA1oY/DEpo69uco2s+8ITfTMzSygfxtSj A0LhmXbvmZ+kYVl6x66ZeBudU5yBp8RSb6EQ+SachuR48JB3oNQVMSQAShC17rKgdoMu tPu6e3vifyaejtBzHxsAxPYoq0wUMha+e6upecJ1I3pqksjDVobyrPoCIVbd47F82wxI mcBRxW0o43tGYJHYA6afwFUZPfAeSO24JC6txW38uya+pWbKQ2GUBmCb3UM2ZeOpVMvt UnxDOBKy3ZTI3sEPTDdcklWl8ZpeSMtxnVgIWgCcLXZbTXgOtKMCwDyIaSpn/YLaO0Mp nkGg== 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=LLjHIli70RtnXlTI4EfBB8zQjRqR6fYYQyFR1XCt3TI=; b=L645Yr5c/ULvmVEefEEOnq8ZT4EdY9cYeutHtUQp0G5FnKmW+CHsSWP3zvh8CuYaoT MsYpRzclvX+ps8a+jvv0iv1aVZqjRdIVosUxnKfStMypVRRABNzAj5YWvCIt5vjjxV5n oQmzgxXEcW3KJmgbOMXNHEsydiBvwRc6lFsdF7uB3AnoLFKjXtHb4n6PJ1cIET+Zafeo libxerHax6WUvk+RxC+YIYcxYeL4R2+gxTajkV/LXxR9y4S63QFuZ+eCcuP8Ms9i0d7J STT/cR/B49gcWxuOgT14b73M/qAckLFwdZg29CADwxFzGJUIS34u0s2hC1asbIE039uT Ecfg== X-Gm-Message-State: AOAM5317nrukMzWNG9alG0Q55ZD/YuiBdq705CdW5CAVqWerydm8t0wL m/ReA0Dc0eJtwm0p5m52NjQ= X-Google-Smtp-Source: ABdhPJxBZuKl2yX1qrLrJhO8AfooCK/RcO1iqNMoYLCS85yGswo/fmNGfIBzwQ+bscKFxkQE56ffpA== X-Received: by 2002:a2e:8953:: with SMTP id b19mr3029047ljk.187.1592501452890; Thu, 18 Jun 2020 10:30:52 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id q11sm876206lfe.34.2020.06.18.10.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 10:30:51 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Thu, 18 Jun 2020 19:30:49 +0200 To: Matthew Wilcox Cc: "Paul E. McKenney" , "Uladzislau Rezki (Sony)" , LKML , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Joel Fernandes , RCU , Oleksiy Avramchenko Subject: Re: [PATCH v2 09/16] rcu/tree: Maintain separate array for vmalloc ptrs Message-ID: <20200618173049.GB14613@pc636> References: <20200525214800.93072-1-urezki@gmail.com> <20200525214800.93072-10-urezki@gmail.com> <20200617234609.GA10087@paulmck-ThinkPad-P72> <20200618005214.GN8681@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200618005214.GN8681@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: B519D1867B05A X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: > > > > 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 don't think that replacing direct function calls with indirect function > calls is a great suggestion with the current state of play around branch > prediction. > > I'd suggest: > > rcu_lock_acquire(&rcu_callback_map); > trace_rcu_invoke_kfree_bulk_callback(rcu_state.name, > bkvhead[i]->nr_records, bkvhead[i]->records); > if (i == 0) { > kfree_bulk(bkvhead[i]->nr_records, > bkvhead[i]->records); > } else { > for (j = 0; j < bkvhead[i]->nr_records; j++) { > vfree(bkvhead[i]->records[j]); > } > } > rcu_lock_release(&rcu_callback_map); > There are two different trace functions, one for "bulk" tracing messages, and another one is per one call of kfree(), though we use to indicate vfree() call. Probably we can rename it to: trace_rcu_invoke_kvfree_callback(); What do you think? > > But I'd also suggest a vfree_bulk be added. There are a few things > which would be better done in bulk as part of the vfree process > (we batch them up already, but i'm sure we could do better). > I was thinking to implement of vfree_bulk() API, but i guess it can be done as future work. Does that sound good? -- Vlad Rezki