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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3C0FC433EF for ; Tue, 22 Feb 2022 15:53:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3381E8D0002; Tue, 22 Feb 2022 10:53:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C0AE8D0001; Tue, 22 Feb 2022 10:53:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 13B6B8D0002; Tue, 22 Feb 2022 10:53:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 04DDE8D0001 for ; Tue, 22 Feb 2022 10:53:39 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id D42AC60E2B for ; Tue, 22 Feb 2022 15:53:38 +0000 (UTC) X-FDA: 79170860916.10.4C273C9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf06.hostedemail.com (Postfix) with ESMTP id E981B18000C for ; Tue, 22 Feb 2022 15:53:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645545217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l6CVgHNITh5wTbLqWE2e3/qhwXVPmAcMBmmuUl7zJ+g=; b=dGCoE918Aa0iRAgjJvSij5BwADydmBm/HGcBF4EDkpraZrvkBGHt7ffY5zMfLeqb7VbO9X 6An1ljE8qibzTkjLBL3o4Q+t7wNrAuDyF0l5gqpWLc6ds0jp4yk4rZ3nL4Eu1pkW00FVtQ mxYLPvb+fclIT6fy2yTkmwyEP8DDXzA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-640-g2J37VjHNtClmxRYUSF2CA-1; Tue, 22 Feb 2022 10:53:34 -0500 X-MC-Unique: g2J37VjHNtClmxRYUSF2CA-1 Received: by mail-wm1-f69.google.com with SMTP id c7-20020a1c3507000000b0034a0dfc86aaso1027226wma.6 for ; Tue, 22 Feb 2022 07:53:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=l6CVgHNITh5wTbLqWE2e3/qhwXVPmAcMBmmuUl7zJ+g=; b=Z6UB6GY/pwNE6VkHTbyWJ9WWEY0AXy4DUWa8MjLGZcpcYzRNpNqN85ihL1adRB4Iuj esRm5x/FzB5DSKRL6L5zc9v5lK9RdvFqHx2BYtWdeV8/8zsYfOUeYYb8hWen+4vLIIw3 iq+v8464m0wyPLzOMt+xFdQAcXrUfYZpBACF6/NB4NOL/PZoiqe9h1jFwzvuy7SxIZk9 d1jvwtH5pXvs67u/hhnepTK3YvUVslgiqWVYnjBgXsJytsf79gATyYx2/Bao3C4HJhzE tDWt/CtsYVlXf+pj5OwyYLhKeg646NBnzTt0LxQSJfL+6wtWAHLoPH+OJu8TlueBRJ/S V2pw== X-Gm-Message-State: AOAM530ifwBBcZJe/LWo78aZvBZkLNnrq3PA9qkE2+237c/rZkG5lrus 5eNtoBUSyZAh75Ozm06Be95KMWuuorcmQO3v6LOIZkWFNLs05MdgStmpo9t+W1xoIEBPZRguC5x Jhrk18Wg/iak= X-Received: by 2002:adf:b34a:0:b0:1ea:8df9:318c with SMTP id k10-20020adfb34a000000b001ea8df9318cmr3083952wrd.190.1645545213225; Tue, 22 Feb 2022 07:53:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo3GvDiqubhPSIJifPiUva9RGNbzGHEZatlkRxV1l7JjrHoN2d+MTshFta3P9CUaYL7LMjlw== X-Received: by 2002:adf:b34a:0:b0:1ea:8df9:318c with SMTP id k10-20020adfb34a000000b001ea8df9318cmr3083945wrd.190.1645545213044; Tue, 22 Feb 2022 07:53:33 -0800 (PST) Received: from ?IPv6:2a0c:5a80:1204:1500:37e7:8150:d9df:36f? ([2a0c:5a80:1204:1500:37e7:8150:d9df:36f]) by smtp.gmail.com with ESMTPSA id v17-20020a05600c12d100b0037c918292d4sm2532981wmd.28.2022.02.22.07.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 07:53:32 -0800 (PST) Message-ID: Subject: Re: [patch 2/2] mm: lru_cache_disable: replace work queue synchronization with synchronize_rcu From: Nicolas Saenz Julienne To: Marcelo Tosatti , linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, Minchan Kim , Matthew Wilcox , Mel Gorman , Juri Lelli , Thomas Gleixner , Sebastian Andrzej Siewior , "Paul E. McKenney" Date: Tue, 22 Feb 2022 16:53:30 +0100 In-Reply-To: <20220222144907.056089321@redhat.com> References: <20220222144706.937848439@redhat.com> <20220222144907.056089321@redhat.com> User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: E981B18000C X-Stat-Signature: du8owyarn7wq83swjk1bew7eohr73h3b Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=dGCoE918; spf=none (imf06.hostedemail.com: domain of nsaenzju@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=nsaenzju@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1645545217-688365 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 Tue, 2022-02-22 at 11:47 -0300, Marcelo Tosatti wrote: > @@ -918,14 +917,23 @@ atomic_t lru_disable_count = ATOMIC_INIT > void lru_cache_disable(void) > { > atomic_inc(&lru_disable_count); > + synchronize_rcu(); > #ifdef CONFIG_SMP > /* > - * lru_add_drain_all in the force mode will schedule draining on > - * all online CPUs so any calls of lru_cache_disabled wrapped by > - * local_lock or preemption disabled would be ordered by that. > - * The atomic operation doesn't need to have stronger ordering > - * requirements because that is enforced by the scheduling > - * guarantees. > + * synchronize_rcu() waits for preemption disabled > + * and RCU read side critical sections > + * For the users of lru_disable_count: > + * > + * preempt_disable, local_irq_disable() [bh_lru_lock()] > + * rcu_read_lock [lru_pvecs CONFIG_PREEMPT_RT] > + * preempt_disable [lru_pvecs !CONFIG_PREEMPT_RT] > + * > + * > + * so any calls of lru_cache_disabled wrapped by > + * local_lock+rcu_read_lock or preemption disabled would be > + * ordered by that. The atomic operation doesn't need to have > + * stronger ordering requirements because that is enforced > + * by the scheduling guarantees. "The atomic operation doesn't need to have stronger ordering requirements because that is enforced by the scheduling guarantees." This is no longer needed. Regards, -- Nicolás Sáenz