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=-5.6 required=3.0 tests=BAYES_00,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 05733C433E1 for ; Thu, 16 Jul 2020 19:03:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BC9D8207FB for ; Thu, 16 Jul 2020 19:03:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="swyc6466" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC9D8207FB 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 37A936B0024; Thu, 16 Jul 2020 15:03:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 32BEF8D0003; Thu, 16 Jul 2020 15:03:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21A446B0028; Thu, 16 Jul 2020 15:03:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 0903A6B0024 for ; Thu, 16 Jul 2020 15:03:46 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 932D81F1B for ; Thu, 16 Jul 2020 19:03:45 +0000 (UTC) X-FDA: 77044863210.12.pain22_0104def26f04 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id EE2331800BCF2 for ; Thu, 16 Jul 2020 19:03:42 +0000 (UTC) X-HE-Tag: pain22_0104def26f04 X-Filterd-Recvd-Size: 6510 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jul 2020 19:03:42 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id r19so9446114ljn.12 for ; Thu, 16 Jul 2020 12:03:42 -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=uQLm+yqvyyrDlHJaC2rIkXacLA9eYNZLnOlnoh9hxck=; b=swyc6466rHmiDhvBnx48LzOoyQSQ/+ijym4BrC1MzTTp9UR080ptucGzJBlzQD7zAQ 9C1M49zcNPC5lGoWvuznezl471FpNOkC2wxDEZ0Z8PM1c3lQjN2RqGdB5QZJ9JtZXZke KCHnxANlf43CEghmN5IJKaY1KpoUmAQqhHsPm4b6vJMwxF5PZwODhGuul4K7lMBxc4HB i6lDT6IwXZrQgzQjNx47XJ65N2di6cEvwy/2JaeNVSxOsn6N35MsIeX6N2C2/S2AsomF TSo3tXPu7kosAPJ7Yx+W2VPhMBzMojFWELPapQUQVDOxeRw7ibjKvud7cX5/IDyv5Zmn CZFQ== 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=uQLm+yqvyyrDlHJaC2rIkXacLA9eYNZLnOlnoh9hxck=; b=ZzfApH7P0OS94NoKfu87Z/IlnRFM9tGxkKrFVGxnzpYbL2XDRBl8owOyloA2qN2tBS O9Q6KspiLw7hg8vXKsevJH/nZ0z7wrfjTSfaZ0HdHO+I8bF2QmIDMrVZYibP9Ff+Qld8 Bh+qliAqAA2N+6RvxZ9wb6nZTS0Vqdrd1u1QwkwxGRLy/tg+gKn7/W1oKeVXwnv2sO9m eShq2xFYSSQtPHiz4xCvpXsvcSjGCkBL4RluFFv0/oUf1LrM9MyQE5G8FtXRHcVzKiBb Bvm5ZBOTs8owuSZhLvuoXDG3fe+81bGaxsV+RNeLiTwMM0K76HVxbYu/fZXw4pgUlGWS zjZA== X-Gm-Message-State: AOAM532amlw5b3z8J7ikq2Ov2WwDRA9RMVhzmFblfiZxcjvoG9u5q76K FfIeE1S7+VO4K6A+dt7D32k= X-Google-Smtp-Source: ABdhPJz/unK1D8S/ze0y2ZvvoDv+FobpH/NjduzAbTJs6a5h1a1rn/Gt8fbpYXHeaOhK9lV/IE6QDw== X-Received: by 2002:a2e:90cc:: with SMTP id o12mr2794823ljg.231.1594926220802; Thu, 16 Jul 2020 12:03:40 -0700 (PDT) Received: from pc636 (h5ef52e31.seluork.dyn.perspektivbredband.net. [94.245.46.49]) by smtp.gmail.com with ESMTPSA id j17sm1351027lfk.31.2020.07.16.12.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 12:03:37 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Thu, 16 Jul 2020 21:03:35 +0200 To: Joel Fernandes Cc: Uladzislau Rezki , Sebastian Andrzej Siewior , LKML , RCU , linux-mm , "Paul E . McKenney" , Andrew Morton , "Theodore Y . Ts'o" , Matthew Wilcox , Oleksiy Avramchenko Subject: Re: [PATCH 1/1] rcu/tree: Drop the lock before entering to page allocator Message-ID: <20200716190335.GA584@pc636> References: <20200715183537.4010-1-urezki@gmail.com> <20200715185628.7b4k3o5efp4gnbla@linutronix.de> <20200716091913.GA28595@pc636> <20200716133647.GA242690@google.com> <20200716143714.GA30965@pc636> <20200716182707.GA552227@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200716182707.GA552227@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: EE2331800BCF2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 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 Thu, Jul 16, 2020 at 02:27:07PM -0400, Joel Fernandes wrote: > On Thu, Jul 16, 2020 at 04:37:14PM +0200, Uladzislau Rezki wrote: > > On Thu, Jul 16, 2020 at 09:36:47AM -0400, Joel Fernandes wrote: > > > On Thu, Jul 16, 2020 at 11:19:13AM +0200, Uladzislau Rezki wrote: > > > > On Wed, Jul 15, 2020 at 07:13:33PM -0400, Joel Fernandes wrote: > > > > > On Wed, Jul 15, 2020 at 2:56 PM Sebastian Andrzej Siewior > > > > > wrote: > > > > > > > > > > > > On 2020-07-15 20:35:37 [+0200], Uladzislau Rezki (Sony) wrote: > > > > > > > @@ -3306,6 +3307,9 @@ kvfree_call_rcu_add_ptr_to_bulk(struct kfree_rcu_cpu *krcp, void *ptr) > > > > > > > if (IS_ENABLED(CONFIG_PREEMPT_RT)) > > > > > > > return false; > > > > > > > > > > > > > > + preempt_disable(); > > > > > > > + krc_this_cpu_unlock(*krcp, *flags); > > > > > > > > > > > > Now you enter memory allocator with disabled preemption. This isn't any > > > > > > better but we don't have a warning for this yet. > > > > > > What happened to the part where I asked for a spinlock_t? > > > > > > > > > > Ulad, > > > > > Wouldn't the replacing of preempt_disable() with migrate_disable() > > > > > above resolve Sebastian's issue? > > > > > > > > > This for regular kernel only. That means that migrate_disable() is > > > > equal to preempt_disable(). So, no difference. > > > > > > But this will force preempt_disable() context into the low-level page > > > allocator on -RT kernels which I believe is not what Sebastian wants. The > > > whole reason why the spinlock vs raw-spinlock ordering matters is, because on > > > RT, the spinlock is sleeping. So if you have: > > > > > > raw_spin_lock(..); > > > spin_lock(..); <-- can sleep on RT, so Sleep while atomic (SWA) violation. > > > > > > That's the main reason you are dropping the lock before calling the > > > allocator. > > > > > No. Please read the commit message of this patch. This is for regular kernel. > > Wait, so what is the hesitation to put migrate_disable() here? It is even > further documentation (annotation) that the goal here is to stay on the same > CPU - as you indicated in later emails. > Actually preempt_disable() does the same for !RT. I agree that migrate_disable() annotation looks better from the point you mentioned. > And the documentation aspect is also something Sebastian brought. A plain > preempt_disable() is frowned up if there are alternative API that document > the usage. > > > You did a patch: > > > > > > if (IS_ENABLED(CONFIG_PREEMPT_RT)) > > return false; > > > > I know, that's what we're discussing. > > So again, why the hatred for migrate_disable() ? :) > Let's do migrate_disable(), i do not mind :) -- Vlad Rezki