Received: by 10.223.185.116 with SMTP id b49csp4121754wrg; Tue, 13 Feb 2018 13:08:55 -0800 (PST) X-Google-Smtp-Source: AH8x224zU3+t8khLGNmUm/ei4jUDWZilFZkOyCNX/CHguhm26zsnff+MP/KaKdKMkWwsmDhKJlFT X-Received: by 10.98.254.21 with SMTP id z21mr2495201pfh.48.1518556135670; Tue, 13 Feb 2018 13:08:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518556135; cv=none; d=google.com; s=arc-20160816; b=G9ZReRUUVw209j+uHh5h3wfo4AKpTpoDf+rG9eNOEFxtxZ4JXrT102XcllX3cKtG3A tUyq5eC7jhZYb0qLNhraQGYrvsNHIUkYf+pdlSZF0ZpmwUaEJmzJQi7yf7126OyLUwaT Utqkc4h/pYCBTga2/MdVBGrb4+U45mSJCMbj7zzfD1WEutUSMMecQ42NCn7EoX7iwBR9 pHacNbtZyOW80C8/0rMPSstYThoqKOoEbIU5soDFw/0whidZV9fTsj0NMS7PFmueKgde Tla2AWsVvlfyPaDOXQiwjs+zMi3X7m9Zz0qfNWMjtJrlVGFwh8dnQFp+4HBKcxUpF4JP YwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=dh7804FoF+jQ90Ax0MmKsjNGQc/qucOZrZwU4Yu0koY=; b=Nk44KGy0dzM1NyzvcyakGJP55mVqx1ENZ6E3Vo66g2q3MRyxapQo7DLf8vx/qRep87 fjsls3LncptUXSmlE5zX83o4tNRs0giB2bGqTlLRtNjkC/LA20H5u0XPXgqd/T5CW5Lu yQ1VC5AnATxxK+AeezWS8YIrYtTa2g2n9nvsfRYLTgMMgH3fEVSsri9QMBc+AX6HBmQF 5flyw0u+Hcs+S9/L1SbpEd++6Zayf05QT8qGlDPW2f7mc3mAlT/8HbBUxVPLvKRpHYcJ f3vdWOlPjTTcpjY5p9Y9LXbzZVqN6vNIR7EBzj2djFT/1+7TFxPKyHgv5Zt+vUQRE0+A a2rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=grlGij8S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id c8-v6si4215045plo.356.2018.02.13.13.08.40; Tue, 13 Feb 2018 13:08:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=grlGij8S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S965839AbeBMVHi (ORCPT + 99 others); Tue, 13 Feb 2018 16:07:38 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:53414 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965676AbeBMVHh (ORCPT ); Tue, 13 Feb 2018 16:07:37 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1DL7NEM175251; Tue, 13 Feb 2018 21:07:25 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-2017-10-26; bh=dh7804FoF+jQ90Ax0MmKsjNGQc/qucOZrZwU4Yu0koY=; b=grlGij8SN62mA7KZi1CJr3o6b+87mfjOQA3eXRL0AVaKDu23oihz9IeVolICfX95qSc0 uyrOWcQuAHqYea/7a59iuMluswRwxnkzLQWS/vkAtBHP20M5M2E/4NjEk+Q+OOvme/TN Y+6p41jdsuCsnp9OkdKZ9KozZJHmdhE0YUHUqqohma88M++gtLu+BMOVM3nq8TmjcwUi jxDWlzB0LMumioC8t5ymWOdFjSTzCILO99KK5x68Aj834PEJxavGB4Cggrg9N5dqkLwa Q6uHdd4ptddU9v6Kfvf/3yc2oonKZ5HgRXMVT/zXEO03+SeJVGNst6NaIV8FSX5/TSqa QQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2g45jurmyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Feb 2018 21:07:24 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1DL6nMF018264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 13 Feb 2018 21:06:50 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1DL6mv5014584; Tue, 13 Feb 2018 21:06:48 GMT Received: from [10.159.246.163] (/10.159.246.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Feb 2018 13:06:48 -0800 Subject: Re: [RFC PATCH v1 00/13] lru_lock scalability To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: aaron.lu@intel.com, ak@linux.intel.com, Dave.Dice@oracle.com, dave@stgolabs.net, khandual@linux.vnet.ibm.com, ldufour@linux.vnet.ibm.com, mgorman@suse.de, mhocko@kernel.org, pasha.tatashin@oracle.com, steven.sistare@oracle.com, yossi.lev@oracle.com References: <20180131230413.27653-1-daniel.m.jordan@oracle.com> <20180208153652.481a77e57cc32c9e1a7e4269@linux-foundation.org> From: Daniel Jordan Organization: Oracle Corporation Message-ID: <40c02402-ab76-6bd2-5e7d-77fea82e55fe@oracle.com> Date: Tue, 13 Feb 2018 16:07:19 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180208153652.481a77e57cc32c9e1a7e4269@linux-foundation.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8804 signatures=668670 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802130251 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/08/2018 06:36 PM, Andrew Morton wrote: > On Wed, 31 Jan 2018 18:04:00 -0500 daniel.m.jordan@oracle.com wrote: > >> lru_lock, a per-node* spinlock that protects an LRU list, is one of the >> hottest locks in the kernel. On some workloads on large machines, it >> shows up at the top of lock_stat. > > Do you have details on which callsites are causing the problem? That > would permit us to consider other approaches, perhaps. Sure, there are two paths where we're seeing contention. In the first one, a pagevec's worth of anonymous pages are added to various LRUs when the per-cpu pagevec fills up: /* take an anonymous page fault, eventually end up at... */ handle_pte_fault do_anonymous_page lru_cache_add_active_or_unevictable lru_cache_add __lru_cache_add __pagevec_lru_add pagevec_lru_move_fn /* contend on lru_lock */ In the second, one or more pages are removed from an LRU under one hold of lru_lock: // userland calls munmap or exit, eventually end up at... zap_pte_range __tlb_remove_page // returns true because we eventually hit // MAX_GATHER_BATCH_COUNT in tlb_next_batch tlb_flush_mmu_free free_pages_and_swap_cache release_pages /* contend on lru_lock */ For a broader context, we've run decision support benchmarks where lru_lock (and zone->lock) show long wait times. But we're not the only ones according to certain kernel comments: mm/vmscan.c: * zone_lru_lock is heavily contended. Some of the functions that * shrink the lists perform better by taking out a batch of pages * and working on them outside the LRU lock. * * For pagecache intensive workloads, this function is the hottest * spot in the kernel (apart from copy_*_user functions). ... static unsigned long isolate_lru_pages(unsigned long nr_to_scan, include/linux/mmzone.h: * zone->lock and the [pgdat->lru_lock] are two of the hottest locks in the kernel. * So add a wild amount of padding here to ensure that they fall into separate * cachelines. ... Anyway, if you're seeing this lock in your workloads, I'm interested in hearing what you're running so we can get more real world data on this.