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 7233EC43217 for ; Tue, 31 May 2022 12:50:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 009C06B0072; Tue, 31 May 2022 08:50:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EFFC66B0073; Tue, 31 May 2022 08:50:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE8906B0074; Tue, 31 May 2022 08:50:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CF4536B0072 for ; Tue, 31 May 2022 08:50:42 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 97A6420553 for ; Tue, 31 May 2022 12:50:42 +0000 (UTC) X-FDA: 79526022324.15.B0F184E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 6654210003F for ; Tue, 31 May 2022 12:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654001435; 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=PQ9GZTWpkSx0AlurU9b72BzKHjHccSN9YLXwnZc+oZM=; b=G8VAMOZlQZBaZfur1KeFF6+yfj4APfBXlvxhKzO7nKBIi3jYqZU4e+NyHuDQnT6VPgAuKK k5FOd8zuve7QdQR7Y3xdOIDYzkYykYbujpVAAex5qci9HZBLUlZ92nPvXPXOuUMZyPxo+t 0CLscjfx6lgPrmlBq27JfaNDXPsm9+M= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-VSZnNXh4NQ2tuSrBY7VuOg-1; Tue, 31 May 2022 08:50:34 -0400 X-MC-Unique: VSZnNXh4NQ2tuSrBY7VuOg-1 Received: by mail-wm1-f70.google.com with SMTP id o32-20020a05600c512000b0039c1c56e757so340909wms.1 for ; Tue, 31 May 2022 05:50:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=PQ9GZTWpkSx0AlurU9b72BzKHjHccSN9YLXwnZc+oZM=; b=jaGYcwTcqNE1kGyL1pqXo4Q28V5y1y8qQWeB8L2iJlmeKIdmsyum40UidLANOntv27 TS4Z0eZ8yxXDDbt4gV/dLtH+0gF/+wJCj6+LsHVK6lNAh3nh0mkX9wd0ItR1aNO+vB/R mIcWvDbygr7158XsmGaX/k4qLWe1CwNpRi/To7zkmP2eydsVv8Ov0QaeS5/KUC+aE6MW cuOQKIY8634ScoNtRE7ELzwV8z2HvhUwsRbLnfxO/fACqqFTnYF8C//GGPlESqEeH+5U xTBdKixY0tpx0nrE9q5wSYAhhIrfodkNgNIuxzzNgNT95CMK1drdkXMFln68G4q1E9OL me1A== X-Gm-Message-State: AOAM5310xdHDYkovHWdBp2UqZXxSKw0q87qfrP99M55BA33tPKataBVU p55RMnK1ayor7j3aqY1usR3HJlIybNGOER1IbClAqQARinx2D5LbQcjKNlchvHFkd1cAgrjoVLo 03i0BFzI+uTw= X-Received: by 2002:a05:600c:1e89:b0:397:82c8:eda9 with SMTP id be9-20020a05600c1e8900b0039782c8eda9mr22415159wmb.156.1654001433146; Tue, 31 May 2022 05:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvJIEqnHWuI6ybmB4RG++fRq6IJObIoYScVxPeHd+ExtbFuMqs2z1vAISWOVM7yHneQ8biYw== X-Received: by 2002:a05:600c:1e89:b0:397:82c8:eda9 with SMTP id be9-20020a05600c1e8900b0039782c8eda9mr22415149wmb.156.1654001432942; Tue, 31 May 2022 05:50:32 -0700 (PDT) Received: from ?IPV6:2003:cb:c708:f100:8096:9368:ba52:a341? (p200300cbc708f10080969368ba52a341.dip0.t-ipconnect.de. [2003:cb:c708:f100:8096:9368:ba52:a341]) by smtp.gmail.com with ESMTPSA id l8-20020adffe88000000b0020d03c14b9csm11594884wrr.1.2022.05.31.05.50.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 May 2022 05:50:32 -0700 (PDT) Message-ID: <4835edc9-501b-cd75-402f-3ebd3b2a57cd@redhat.com> Date: Tue, 31 May 2022 14:50:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4 1/4] mm: reduce the rcu lock duration To: Miaohe Lin , akpm@linux-foundation.org, naoya.horiguchi@nec.com Cc: 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 References: <20220530113016.16663-1-linmiaohe@huawei.com> <20220530113016.16663-2-linmiaohe@huawei.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220530113016.16663-2-linmiaohe@huawei.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Stat-Signature: xifoeyp1f1w44hxfowqkgrr41ac8n5pf Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G8VAMOZl; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf14.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 6654210003F X-HE-Tag: 1654001438-859 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 30.05.22 13:30, 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. > > Reviewed-by: Muchun Song > Reviewed-by: Christoph Hellwig > Reviewed-by: Oscar Salvador > Signed-off-by: Miaohe Lin > Cc: Huang Ying > Cc: David Howells > Cc: Christoph Lameter Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb