Received: by 10.223.176.5 with SMTP id f5csp279588wra; Thu, 1 Feb 2018 20:20:01 -0800 (PST) X-Google-Smtp-Source: AH8x227EdsESFPphrO2pSoGP6+6g0+3Slxssns9MPzbDgATncaXxuCzesnuRiTLL0wJoEmDK6Lko X-Received: by 10.98.134.206 with SMTP id x197mr27312921pfd.82.1517545201238; Thu, 01 Feb 2018 20:20:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517545201; cv=none; d=google.com; s=arc-20160816; b=odm11m2Auttlib9hHzy24dkMPiPZnOZvQjQ1yUjEWlRttx90WVlOrObyvj3NbC3Bnl 6Yzq5brarwzMVAPix1IQ02xzeYYlyjnalsYpKZBiWoQuCHpTbuaC/YU+DKU58OIDwsKB dUAdU1U9eBDp6yceyUsDzHpSvUs0+Ki8ZjiDlpdFZunA+2i1UyK7a1qlfdptYRaHX0Ye Fpy/mj/0N8zQcfn9ZQcOegdGnlePSnP2JVC1XgPYd43DLXeU5Ge9kBRiBQCjPapSf/cE bTTVHsZq7vhDJtKdKHqJFyP3mcxejewDeyvmEktRGfT1m8d3LLih7c7xGfXixuR/UWQW rk0g== 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:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=pZxNAY5qyYBOtfvNi1N4t3x7qMFvgHH9eCcHB13sA2Y=; b=zjhJxZZLwAzXLx5OvTVME6JNTKNLrTgTQBGCQg3OX8CLJBOd1+u2A2Z/P4skV65ZuW Vec0ldcc/weXYjXW/pXJ+3e4arNFwPiOCjiGDkobhKfDTsNQFtmtL8iGuszOkGSMBEGI DwB0wb6DYbsAubOQ2Xp2kJqwWzHflBMgIx7m6u3S3Si0mkLpV/Ik9eDvn67d1UjJwLpK F2umNTZfEniMCKM7SIDleJTWChcGPTXgvFHbLamX7bM8TSM/bfrKwmgI6hz5cA4Kk47C CUF6UK9hYC3ug77sOfqvmMqppgs+wBVx/7MsnVSxB0TAamu1ZtMcD1C1Z8cEkaiv7YbF 8Hxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=o/bOS5Lj; 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 t88si1014713pfj.196.2018.02.01.20.19.46; Thu, 01 Feb 2018 20:20:01 -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=o/bOS5Lj; 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 S1751732AbeBBES0 (ORCPT + 99 others); Thu, 1 Feb 2018 23:18:26 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:37698 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751544AbeBBEST (ORCPT ); Thu, 1 Feb 2018 23:18:19 -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 w124Hue4157207; Fri, 2 Feb 2018 04:18:07 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=pZxNAY5qyYBOtfvNi1N4t3x7qMFvgHH9eCcHB13sA2Y=; b=o/bOS5Ljp5jTp2E0k8fVyFvdo765YnW5CUqNZBjzw5bnBSevx8y/EUVPRsKgc6AXgcVT W+U2EzhSRZ8bmt6VDPz5KFMw5415mtSU/ZCMIZBe1ns6QTpxmaVbxs/SDNNydcUuyWwa TAYUBRFQIT7jvBJhO6Z70VIXbu5QhG+1muEk3gSDSKu2QLpHJfy9Caf+//JW2Jt8O5OX EHgIU4LgzpgnVHOXsgRnU8XPEeU+ZLZq32QU7mz/Ag1ZGUad0ci+yc0HzTcrRzDD60LO 4YC5cEJDFH4TsPxwrppFPljvZJQnHJwqyqCtqRQ5SIIM+n6xTleUCyKm3gXwrIwbDXgZ iw== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2fvg00848t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Feb 2018 04:18:07 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w124I534017660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Feb 2018 04:18:06 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w124I44M028732; Fri, 2 Feb 2018 04:18:04 GMT Received: from [10.39.194.240] (/10.39.194.240) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 01 Feb 2018 20:18:04 -0800 Subject: Re: [RFC PATCH v1 00/13] lru_lock scalability To: Steven Whitehouse , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: aaron.lu@intel.com, ak@linux.intel.com, akpm@linux-foundation.org, 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> <6bd1c8a5-c682-a3ce-1f9f-f1f53b4117a9@redhat.com> From: Daniel Jordan Message-ID: Date: Thu, 1 Feb 2018 23:18:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <6bd1c8a5-c682-a3ce-1f9f-f1f53b4117a9@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8792 signatures=668660 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 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-1802020042 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2018 10:54 AM, Steven Whitehouse wrote: > Hi, > > > On 31/01/18 23:04, 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. >> >> One way to improve lru_lock scalability is to introduce an array of locks, >> with each lock protecting certain batches of LRU pages. >> >>          *ooooooooooo**ooooooooooo**ooooooooooo**oooo ... >>          |           ||           ||           || >>           \ batch 1 /  \ batch 2 /  \ batch 3 / >> >> In this ASCII depiction of an LRU, a page is represented with either '*' >> or 'o'.  An asterisk indicates a sentinel page, which is a page at the >> edge of a batch.  An 'o' indicates a non-sentinel page. >> >> To remove a non-sentinel LRU page, only one lock from the array is >> required.  This allows multiple threads to remove pages from different >> batches simultaneously.  A sentinel page requires lru_lock in addition to >> a lock from the array. >> >> Full performance numbers appear in the last patch in this series, but this >> prototype allows a microbenchmark to do up to 28% more page faults per >> second with 16 or more concurrent processes. >> >> This work was developed in collaboration with Steve Sistare. >> >> Note: This is an early prototype.  I'm submitting it now to support my >> request to attend LSF/MM, as well as get early feedback on the idea.  Any >> comments appreciated. >> >> >> * lru_lock is actually per-memcg, but without memcg's in the picture it >>    becomes per-node. > GFS2 has an lru list for glocks, which can be contended under certain workloads. Work is still ongoing to figure out exactly why, but this looks like it might be a good approach to that issue too. The main purpose of GFS2's lru list is to allow shrinking of the glocks under memory pressure via the gfs2_scan_glock_lru() function, and it looks like this type of approach could be used there to improve the scalability, Glad to hear that this could help in gfs2 as well. Hopefully struct gfs2_glock is less space constrained than struct page for storing the few bits of metadata that this approach requires. Daniel > > Steve. > >> >> Aaron Lu (1): >>    mm: add a percpu_pagelist_batch sysctl interface >> >> Daniel Jordan (12): >>    mm: allow compaction to be disabled >>    mm: add lock array to pgdat and batch fields to struct page >>    mm: introduce struct lru_list_head in lruvec to hold per-LRU batch >>      info >>    mm: add batching logic to add/delete/move API's >>    mm: add lru_[un]lock_all APIs >>    mm: convert to-be-refactored lru_lock callsites to lock-all API >>    mm: temporarily convert lru_lock callsites to lock-all API >>    mm: introduce add-only version of pagevec_lru_move_fn >>    mm: add LRU batch lock API's >>    mm: use lru_batch locking in release_pages >>    mm: split up release_pages into non-sentinel and sentinel passes >>    mm: splice local lists onto the front of the LRU >> >>   include/linux/mm_inline.h | 209 +++++++++++++++++++++++++++++++++++++++++++++- >>   include/linux/mm_types.h  |   5 ++ >>   include/linux/mmzone.h    |  25 +++++- >>   kernel/sysctl.c           |   9 ++ >>   mm/Kconfig                |   1 - >>   mm/huge_memory.c          |   6 +- >>   mm/memcontrol.c           |   5 +- >>   mm/mlock.c                |  11 +-- >>   mm/mmzone.c               |   7 +- >>   mm/page_alloc.c           |  43 +++++++++- >>   mm/page_idle.c            |   4 +- >>   mm/swap.c                 | 208 ++++++++++++++++++++++++++++++++++++--------- >>   mm/vmscan.c               |  49 +++++------ >>   13 files changed, 500 insertions(+), 82 deletions(-) >> >