Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1020156ybt; Fri, 19 Jun 2020 21:51:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUbTPJhU+57iQaN7DcrKJ7e1DMWFPfGJ8mVEYmVwWLCa57P/H507tjVjhsW2E6U/CJnq45 X-Received: by 2002:a17:906:4c81:: with SMTP id q1mr6644778eju.273.1592628672307; Fri, 19 Jun 2020 21:51:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592628672; cv=none; d=google.com; s=arc-20160816; b=rqTXw3CiuxkW54n/25qn5nOckQuzXB2Zn4HUo+6shy0Oq4H+N5cdCVtSB1OVNnDa1P XtvSOVYtmlyvjlaIxckk4Thmeay6fr7qUw0ePpOFg4s69yMWbQzDuATWIyFINSb0JxP0 pTsAGK9f8GFcwJWpwj4yrqvJg+KsxXKQVtcBwtic/+rmydEvmna/0X8Mk51Y3fo0lRZv JbsiPA7ehVL+sJKeHx6oi5yQ5W25uy4xXRSs6gSHnO6vOMnHJlzKjZeJURrXNOm7exrv Q0Rf8/bmYBSWRnsdcGhkmRDWLdIQT3ouCckQkMSMpK2fZ5xr/8J9VjNDfESsR1yvO6N+ y8EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Fh1TauyG94rhfUBSdHsqI+sTrR/HW9QksqHgZMTrwBE=; b=UAeS973Uww8TVswVuAC+8SJF21mzbMNPYUa0+kUMvStFhS9Ih6lEFvAArr4XDpxrqs K14QZgKIroJblHhA5V6hNF5DGnR4b9hElfIOZUwBcoD/QlQP/Z0d7B+sTKuD7fkvq0AL i3/xlUZCkLue4OJ8hRKN4fGCPFW4/FGDjSuWtI8sw+H0jdovZFwtMgreaV1kNZdFhQdi h/JbX6PruPR4BhY2s7NG8fpMwf7Z9AhAGfOwlnI+vivJ7GGd1fTAlcDvSoKQeMKtSCzs Zo7TlV4dIyXWrGjVqNLUAE/Xl9tbFDb6/UBLRGftpg8ccwtMKNWihy7MfLoHLnf0xAcZ lT2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=znXBd2T4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a21si4981421ejf.332.2020.06.19.21.50.50; Fri, 19 Jun 2020 21:51:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=znXBd2T4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728283AbgFSV5J (ORCPT + 99 others); Fri, 19 Jun 2020 17:57:09 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:55400 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726220AbgFSV5G (ORCPT ); Fri, 19 Jun 2020 17:57:06 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05JLlxg9037623; Fri, 19 Jun 2020 21:57:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Fh1TauyG94rhfUBSdHsqI+sTrR/HW9QksqHgZMTrwBE=; b=znXBd2T4mtleYKCi6c7EstsMXMARd5a6vKJLbs2GOEqSryoCxLKYTjLyJBpt5nw5bvTY dmSI1HoX0wSTYGBs25Lrxr0RCBiflgP0MnVlBilJSX4JjUmkHCCPFjCtLL9N2n0e3fJO uhsXSH8rR6gtXb0n/S9aOBmW9Ch2N2ve6+CiwLpIz1SOj50CC727B4tQ2czdkouCoSpZ HHa6wh8D2V5Inv6zfMl5n9JNIFR7sagELED6qkC7Qt1m/hYKrxbaqwXpcoqqSM/oyssx Y5RltoRP9EzPnHoOdWOPN+U9xGZC2pYQeZrEtxzlRJFe8d7rG+6R7Angrvvkin5enBc8 fQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 31q6608w70-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 19 Jun 2020 21:57:01 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 05JLnIeI076693; Fri, 19 Jun 2020 21:57:01 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 31q66s28td-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 19 Jun 2020 21:57:01 +0000 Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 05JLv0D3002185; Fri, 19 Jun 2020 21:57:00 GMT Received: from dhcp-10-159-240-10.vpn.oracle.com (/10.159.240.10) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 19 Jun 2020 14:57:00 -0700 Subject: Re: [PATCH] proc: Avoid a thundering herd of threads freeing proc dentries To: "Eric W. Biederman" Cc: Matthew Wilcox , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox , Srinivas Eeda , "joe.jin@oracle.com" , Wengang Wang References: <54091fc0-ca46-2186-97a8-d1f3c4f3877b@oracle.com> <20200618233958.GV8681@bombadil.infradead.org> <877dw3apn8.fsf@x220.int.ebiederm.org> <2cf6af59-e86b-f6cc-06d3-84309425bd1d@oracle.com> <87bllf87ve.fsf_-_@x220.int.ebiederm.org> <87k1036k9y.fsf@x220.int.ebiederm.org> From: Junxiao Bi Message-ID: <68a1f51b-50bf-0770-2367-c3e1b38be535@oracle.com> Date: Fri, 19 Jun 2020 14:56:58 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <87k1036k9y.fsf@x220.int.ebiederm.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9657 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 phishscore=0 mlxscore=0 bulkscore=0 malwarescore=0 mlxlogscore=926 suspectscore=11 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006190152 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9657 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxscore=0 spamscore=0 clxscore=1015 mlxlogscore=945 suspectscore=11 impostorscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006190152 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/19/20 10:24 AM, ebiederm@xmission.com wrote: > Junxiao Bi writes: > >> Hi Eric, >> >> The patch didn't improve lock contention. > Which raises the question where is the lock contention coming from. > > Especially with my first variant. Only the last thread to be reaped > would free up anything in the cache. > > Can you comment out the call to proc_flush_pid entirely? Still high lock contention. Collect the following hot path.     74.90%     0.01%  proc_race [kernel.kallsyms]                               [k] entry_SYSCALL_64_after_hwframe             |              --74.89%--entry_SYSCALL_64_after_hwframe                        |                         --74.88%--do_syscall_64                                   |                                   |--69.70%--exit_to_usermode_loop                                   |          |                                   |           --69.70%--do_signal                                   |                     |                                   | --69.69%--get_signal                                   | |                                   | |--56.30%--do_group_exit                                   | |          |                                   | |           --56.30%--do_exit                                   | |                     |                                   | |                     |--27.50%--_raw_write_lock_irq                                   | |                     |          |                                   | |                     | --27.47%--queued_write_lock_slowpath                                   | |                     |                     |                                   | |                     | --27.18%--native_queued_spin_lock_slowpath                                   | |                     |                                   | |                     |--26.10%--release_task.part.20                                   | |                     |          |                                   | |                     |           --25.60%--_raw_write_lock_irq                                   | |                     |                     |                                   | |                     | --25.56%--queued_write_lock_slowpath                                   | |                     |                                |                                   | |                     | --25.23%--native_queued_spin_lock_slowpath                                   | |                     |                                   | |                      --0.56%--mmput                                   | |                                |                                   | |                                 --0.55%--exit_mmap                                   | | |                                 --13.31%--_raw_spin_lock_irq |                                           | | --13.28%--native_queued_spin_lock_slowpath                                   | Thanks, Junxiao. > > That will rule out the proc_flush_pid in d_invalidate entirely. > > The only candidate I can think of d_invalidate aka (proc_flush_pid) vs ps. > > Eric