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 7ECC8C433EF for ; Tue, 31 May 2022 12:59:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0290E6B0073; Tue, 31 May 2022 08:59:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F190A6B0074; Tue, 31 May 2022 08:59:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DDFA26B0075; Tue, 31 May 2022 08:59:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D06AB6B0073 for ; Tue, 31 May 2022 08:59:17 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id A639180331 for ; Tue, 31 May 2022 12:59:17 +0000 (UTC) X-FDA: 79526043954.27.7F47710 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id CB7C94005F for ; Tue, 31 May 2022 12:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BUGBteA8JfJc0y+36tB67b05qFOjdvVc5xttIZ7wN/s=; b=pgO9wo+FHXzCz6tvx585lEwztt X6GBD59PGZXI0hlG4z61Q+5Ogny9aGHZsbtPHm9jSzubwFESORwhFP4Ydh+LWGt17e5jCCP1BR5t/ FW477VYiIpBYv3Xh3cHlbagKul15CCZpzjjNPVlkPhIUwvMUOPyuehCLfaqWeL3Qpo3PoOrWHivrP XL32olI79zvFkNvcD/e1dsrQoYzIonKuI/Lta3uTgOuM85YxMcDm7A6p3bpJifQBbh45y+Edec+gw /hDZRkiEfjBeOvxbQ6g+qDg/6RgpjghKLJ6QDyXVmzfu/4xhjJT+bVfj5JP/QT/7Cji2flZeZ6DuP 5l97hFfg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nw1SC-005O1Z-0G; Tue, 31 May 2022 12:58:32 +0000 Date: Tue, 31 May 2022 13:58:31 +0100 From: Matthew Wilcox To: Miaohe Lin Cc: akpm@linux-foundation.org, naoya.horiguchi@nec.com, peterx@redhat.com, apopple@nvidia.com, ying.huang@intel.com, osalvador@suse.de, mike.kravetz@oracle.com, songmuchun@bytedance.com, hch@lst.de, dhowells@redhat.com, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 1/4] mm: reduce the rcu lock duration Message-ID: References: <20220530113016.16663-1-linmiaohe@huawei.com> <20220530113016.16663-2-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220530113016.16663-2-linmiaohe@huawei.com> X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: CB7C94005F X-Stat-Signature: 8419dzu5zin8wgd1xkrgg1p8jdq5apw5 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=pgO9wo+F; dmarc=none; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1654001949-914067 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 Mon, May 30, 2022 at 07:30:13PM +0800, Miaohe Lin wrote: > Commit 3268c63eded4 ("mm: fix move/migrate_pages() race on task struct") > extends the period of the rcu_read_lock until after the permissions checks > are done to prevent the task pointed to from changing from under us. But > the task_struct refcount is also taken at that time, the reference to task > is guaranteed to be stable. So it's unnecessary to extend the period of > the rcu_read_lock. Release the rcu lock after task refcount is successfully > grabbed to reduce the rcu holding time. But why bother? You know the RCU read lock isn't a "real" lock, right?