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=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 4E874C433E6 for ; Thu, 16 Jul 2020 18:27:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCEBA2076A for ; Thu, 16 Jul 2020 18:27:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=joelfernandes.org header.i=@joelfernandes.org header.b="N0VSuyhp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCEBA2076A 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 02F2E8D0005; Thu, 16 Jul 2020 14:27:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F210F6B0083; Thu, 16 Jul 2020 14:27:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC0EB8D0005; Thu, 16 Jul 2020 14:27:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0090.hostedemail.com [216.40.44.90]) by kanga.kvack.org (Postfix) with ESMTP id C2A226B0082 for ; Thu, 16 Jul 2020 14:27:10 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2EDDE248E for ; Thu, 16 Jul 2020 18:27:10 +0000 (UTC) X-FDA: 77044771020.06.leg86_090f92b26f04 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id C97E210054462 for ; Thu, 16 Jul 2020 18:27:09 +0000 (UTC) X-HE-Tag: leg86_090f92b26f04 X-Filterd-Recvd-Size: 5743 Received: from mail-qt1-f196.google.com (mail-qt1-f196.google.com [209.85.160.196]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 16 Jul 2020 18:27:09 +0000 (UTC) Received: by mail-qt1-f196.google.com with SMTP id d27so5678145qtg.4 for ; Thu, 16 Jul 2020 11:27:09 -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=5rsi6VXTy6zEAJKBUYV2Ht/nE3vN2e2bAz64X8s/LgM=; b=N0VSuyhp4KQTnN8AKh+O9e5uvpEO8KgGXe9kUGSjBlmgee2680KWI2CeitG7HLqBMw nNu+6VOtJWE9aNlpCsdUhELJxfymlhmSZmrxu5u01EVEM5Wx+bviIzg3IkoaZqjgXFCr Cef/uVXHi57sj5UOMqc/HtL+7aOvzOBEVYYUg= 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=5rsi6VXTy6zEAJKBUYV2Ht/nE3vN2e2bAz64X8s/LgM=; b=uc+y3Sp9glp1x8vSMY8gFoVlLC4mAGz8NXCd3zk1tBxhqmEfu+5SHcxY2GItLwCxee B9kDTCWuJMMhIbPbTgHcqLdfAG5DqxHTObRByA5KkIBaah/uEJ6wryN1NVuci8kXrjHk 3VUew747vEj+ND6mnL9XaDeYTMezz8XZviIgbZN+C9iw7AzNx8jpYf8GBxGxBwUuoypK +ISdBTUInzOZa3E5evpfZ4Br9gN3rWig9JdjrsTcl9FjTeVTGhFk7tQIdpZHX6OYphRH LixpZ4w2KextQ98DY0KR9pUpJsxLtfS3w5OkcQps7fsELd71iATHekW8fmAxsQo9DfV1 +w0g== X-Gm-Message-State: AOAM530SsLfNZS9j+bLYSHliRAFtZoChOUxCyRu4U76MGcouEY/a1utR Xi9ol/bR7MQDsnD6RBtdHsxy0Q== X-Google-Smtp-Source: ABdhPJydThqBZRNpBVcE0X40Iw1AJZzZSHKvZIOL34vgx/2SYb5HpN8Bni+vPzlsOg+LdEyuVRQwqg== X-Received: by 2002:ac8:2928:: with SMTP id y37mr6667933qty.245.1594924028628; Thu, 16 Jul 2020 11:27:08 -0700 (PDT) Received: from localhost ([2620:15c:6:12:cad3:ffff:feb3:bd59]) by smtp.gmail.com with ESMTPSA id b22sm7511470qka.43.2020.07.16.11.27.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 11:27:07 -0700 (PDT) Date: Thu, 16 Jul 2020 14:27:07 -0400 From: Joel Fernandes To: Uladzislau Rezki Cc: 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: <20200716182707.GA552227@google.com> References: <20200715183537.4010-1-urezki@gmail.com> <20200715185628.7b4k3o5efp4gnbla@linutronix.de> <20200716091913.GA28595@pc636> <20200716133647.GA242690@google.com> <20200716143714.GA30965@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200716143714.GA30965@pc636> X-Rspamd-Queue-Id: C97E210054462 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 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. 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() ? :) thanks, - Joel