Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5816896ioo; Wed, 1 Jun 2022 13:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfqTK3UH25fq6+pRyizPX9Xd4lPPmWOgz7x0aMR2zI1Luz1looqWER0RoP1Y6FtB7kChKD X-Received: by 2002:a65:43c2:0:b0:3db:7de6:99f8 with SMTP id n2-20020a6543c2000000b003db7de699f8mr922976pgp.347.1654114353956; Wed, 01 Jun 2022 13:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654114353; cv=none; d=google.com; s=arc-20160816; b=XbRGtVwAxnyVmBdMUpqQANyTnG3T1+ihEYVUV2kbthuXhtJtAqNguSVJhbWYjikSOt THkEw1Z0QECiyCUJ22Q+3eXsAFPw3uNEQFjtMo6PmtUHUQUzdCPYjROPBi3w/e+Z2CKl Dvtupgjbs7Aovqu/Kuiy2AjB11jquiGthLtN/XQht6phYlabVbkBgMIsVFgixjxX4dxu jN4nsxcwtweeH18e6R20j5WX9TSBLaEwkTZgofHVukMzjUemDgdEGO8fxRMY223tuy8d 9X9ESwl8FSxpkNDgWUszseILnLhfAroDrqBvHqNak9BcRkBy2cszVjqU7KazCKsXNxq5 tUDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BUGBteA8JfJc0y+36tB67b05qFOjdvVc5xttIZ7wN/s=; b=xvq3lJD9H8Ev4jzAp22VnMm6Wrrz/7aahqNSpNg2joBb2+Eb+YybnuposPURjd/fHi mvEoCFhZUembTP5RkJuZTk0ARHDK30nOrwJX4UC1NMHMm1aIZEpwAqPmv6negveqnWQi X4C+EaTq0zvvOSMrCAc5W1U4nQjRorsIjsPVXO2+Q01X3T5NxSStPI+lNQr6SiNjCbY5 XOcCC5u+ZKMlzVIQW5awKsMYdzJxE0UabzpqtMSCc+2KzlflMHAQYHhtUIKQ8uvH2Iv/ oSFUmBACFOrRKejAqKkGe+0Xhl4JXQG1AV/IJWjZu/9DpU8mBjNPY6NwQb4473FCjTTC VPkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pgO9wo+F; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d14-20020a170902cece00b0016397d8ddeesi1750084plg.517.2022.06.01.13.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:12:33 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=pgO9wo+F; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BE38122FA02; Wed, 1 Jun 2022 12:26:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344427AbiEaM7R (ORCPT + 99 others); Tue, 31 May 2022 08:59:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245085AbiEaM7Q (ORCPT ); Tue, 31 May 2022 08:59:16 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4969165A2 for ; Tue, 31 May 2022 05:59:14 -0700 (PDT) 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-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?