Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3134008ybz; Sun, 3 May 2020 18:11:09 -0700 (PDT) X-Google-Smtp-Source: APiQypIVz6NFjbsRo4qc7+mOo7c88B631/e4x2B/T+a2jFigNgYSXZ+C+sdVI+lPP9byAh4EAb/k X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr12271174edy.182.1588554669091; Sun, 03 May 2020 18:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588554669; cv=none; d=google.com; s=arc-20160816; b=aX+w8YfoAl/urjnNRCFSAPIi/siga+k5uvAvhYwPgCqb0pIEhitH7POuYmRr2fBTcj SVBZZQFDzYbzXodK9135/tt/TgJTbbtURgwjWyqQXS9fUALT+PPmDXwZtdLptYgl2a+u cQfKjPX52DzA3MIO6g8mkMALaaEFTdSGYKreI9IdoaDyxL+Y2U8p/B30uOlKmhChuWnd +sowJEx0R49E1jab8W6WVuc6JBH8JNhMX5f7iZJc5Ra/blRMSSL3uFF5UApjM7pcz3V9 r1HJV9j9zOSllrJCYbBb5XTBoij7nLZpdN/nsNCPkKA2lJHvoQFACDFyAplUsS4569aM Uy8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=xI7Qm85+J9yYa3BECz1PpAq35SrAJXBLbUl+ywDnfIo=; b=lfA8jwOThMYfYsrEkMZAUtXb8cQFiK2rUYikMSyVtWsOgMkmw8JtZ/pnS8jFKRPh3M 7UcyugZTzOvif90B8WJVPVfvgJ14AouOoJItrFqvFtg1q2JMhFgpViz++o8vJRa4TBI2 Yj6nVVYO+y2PifvlLbQtlV7CzBkEmT5EthMstk6W1oxyoa232uTzDPxqHRHGY170Og+o UKZdEmXaIiMuuh3N8bCan9ub/AG/Rgp1Rl/UIairNVdVDOSbtnAZQmorzFxAVBhsh0iG mCxUr8PQmM3GSgvR0L6P4WPIkwo0jXRjkE3MP+LMzpEJkqRvZdTh8TwvjsDWS+tZYkYj v+gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=vpgZTmS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a19si6094958ejs.131.2020.05.03.18.10.25; Sun, 03 May 2020 18:11:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=vpgZTmS7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726550AbgEDAYk (ORCPT + 99 others); Sun, 3 May 2020 20:24:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726377AbgEDAYj (ORCPT ); Sun, 3 May 2020 20:24:39 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B776EC061A0F for ; Sun, 3 May 2020 17:24:39 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id g185so1527317qke.7 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=I/tdqiLzLdQutN22tr+X9ZdOWG/H9myba40Dg8RJH79DqHgcceINKOUUVZegV5QIcF uHozuCTQka2bbbjTaCreyA24KuIWWUGcf5vOkqQBVu/AJAdND+OH7vKElLuCmUPaLg98 Fo9o8ZynwE9aLD+RIdY52nJwD9W9CbDCrLQ4DN/RssrkZsZUsCuMRzWVBXyX0Co4uxRM 5U7IN29/gt+Rqai8kD8ULLIv6DOaunBiJMpUA1BorfxR9diFUyw11TYEXCw/+p2fCE6q gRZ7UgJfh2WWzKR/lEwVb2SJFBvSU8DMzkNP/gqfFXycusqN57vMlYROmFeaPaocaneb aJeg== X-Gm-Message-State: AGi0PuaUN9J+YY4twZRsAsehyvL9KNoPoOOhMdsifcgsQoKvpvgdKHIM yWjak28DKJQPppc4exc2yslwgQ== 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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