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=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 110E5C28CBC for ; Mon, 4 May 2020 00:24:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C68502073B for ; Mon, 4 May 2020 00:24:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="vpgZTmS7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C68502073B 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 629D18E0005; Sun, 3 May 2020 20:24:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E0F68E0001; Sun, 3 May 2020 20:24:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C89D8E0005; Sun, 3 May 2020 20:24:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0162.hostedemail.com [216.40.44.162]) by kanga.kvack.org (Postfix) with ESMTP id 3218B8E0001 for ; Sun, 3 May 2020 20:24:40 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E05C382499A8 for ; Mon, 4 May 2020 00:24:39 +0000 (UTC) X-FDA: 76777140678.30.word22_7fff68f721151 X-HE-Tag: word22_7fff68f721151 X-Filterd-Recvd-Size: 5387 Received: from mail-qk1-f194.google.com (mail-qk1-f194.google.com [209.85.222.194]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Mon, 4 May 2020 00:24:39 +0000 (UTC) Received: by mail-qk1-f194.google.com with SMTP id k81so12358378qke.5 for ; Sun, 03 May 2020 17:24:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xI7Qm85+J9yYa3BECz1PpAq35SrAJXBLbUl+ywDnfIo=; b=vpgZTmS7D85XFaWuubB35aigMgPfNH5vS1YnNRzviB7wv/20FlsbirhRkjg9zOgEEA 7iLGF4H8xJvd1bNUd0FCIkaDFGVwxN3nHI38lr3P/K/eOgye89BTBZzGIz5jaXEjes/a NIGFyOoAYZFX4lZRDVkIolGMfeBq08naC9rLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xI7Qm85+J9yYa3BECz1PpAq35SrAJXBLbUl+ywDnfIo=; b=j8XSvV92JMVu0v82S7xkT+3QWhha9Vvz7dcuVNBUnag1TAuSEwyHnICFUQegekD2Is UrswbUxfjl33qm41DPdBBzAZlXeehz+pA6xG9QD81VB0YgrnUc1+Z7tiAn14ZYvu+p33 OavHqhFOdzKtqdn8SwG3/uZMe+Ha06dKPH2cdBBFOqXkCYtf37Y2OztyZ+hVoBRazEbA sKDohu8TN7jzLjEIhfq5wruNxhVpRhCSUxaksFBrXDyiNSHLkCGTptCC7A0jm2/wUwK2 5CSzzwEoVCRnPdREAPQfEdCTobpfpbYen6yd5EpxL71N12cdcoIdhcbqoDhctBXjVBaO gb4Q== X-Gm-Message-State: AGi0PuacG2ciFduKxyuryLTaM3zzoYAWB5l7G0k2cz0bAUGwzHon9xbt uGu/5hN/EScJlqyflAHGVmLlKA== X-Google-Smtp-Source: APiQypLzxAGctzs8HcSpHXiYBWEZS0iGP3Ge6vZbGNZgWlf7z6MAH+MfKEicRMukpaZPrAXHEY5pGg== X-Received: by 2002:a05:620a:89c:: with SMTP id b28mr1490696qka.380.1588551878821; Sun, 03 May 2020 17:24:38 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id d69sm7491203qkc.106.2020.05.03.17.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 May 2020 17:24:38 -0700 (PDT) Date: Sun, 3 May 2020 20:24:37 -0400 From: Joel Fernandes To: "Paul E. McKenney" Cc: "Uladzislau Rezki (Sony)" , LKML , linux-mm@kvack.org, Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , RCU , Oleksiy Avramchenko Subject: Re: [PATCH 20/24] rcu/tree: Make kvfree_rcu() tolerate any alignment Message-ID: <20200504002437.GA212435@google.com> References: <20200428205903.61704-1-urezki@gmail.com> <20200428205903.61704-21-urezki@gmail.com> <20200501230052.GG7560@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200501230052.GG7560@paulmck-ThinkPad-P72> 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: On Fri, May 01, 2020 at 04:00:52PM -0700, Paul E. McKenney wrote: > On Tue, Apr 28, 2020 at 10:58:59PM +0200, Uladzislau Rezki (Sony) wrote: > > From: "Joel Fernandes (Google)" > > > > Handle cases where the the object being kvfree_rcu()'d is not aligned by > > 2-byte boundaries. > > > > Signed-off-by: Uladzislau Rezki (Sony) > > Signed-off-by: Joel Fernandes (Google) > > --- > > kernel/rcu/tree.c | 9 ++++++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > index 501cac02146d..649bad7ad0f0 100644 > > --- a/kernel/rcu/tree.c > > +++ b/kernel/rcu/tree.c > > @@ -2877,6 +2877,9 @@ struct kvfree_rcu_bulk_data { > > #define KVFREE_BULK_MAX_ENTR \ > > ((PAGE_SIZE - sizeof(struct kvfree_rcu_bulk_data)) / sizeof(void *)) > > > > +/* Encoding the offset of a fake rcu_head to indicate the head is a wrapper. */ > > +#define RCU_HEADLESS_KFREE BIT(31) > > Did I miss the check for freeing something larger than 2GB? Or is this > impossible, even on systems with many terabytes of physical memory? > Even if it is currently impossible, what prevents it from suddenly > becoming all too possible at some random point in the future? If you > think that this will never happen, please keep in mind that the first > time I heard "640K ought to be enough for anybody", it sounded eminently > reasonable to me. > > Besides... > > Isn't the offset in question the offset of an rcu_head struct within > the enclosing structure? If so, why not keep the current requirement > that this be at least 16-bit aligned, especially given that some work > is required to make that alignment less than pointer sized? Then you > can continue using bit 0. > > This alignment requirement is included in the RCU requirements > documentation and is enforced within the __call_rcu() function. > > So let's leave this at bit 0. This patch is needed only if we are growing the fake rcu_head. Since you mentioned in a previous patch in this series that you don't want to do that, and just rely on availability of the array of pointers or synchronize_rcu(), we can drop this patch. If we are not dropping that earlier patch, let us discuss more. thanks, - Joel