Message ID | 20180911005949.5635-5-daniel.m.jordan@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7AB914E5 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 11 Sep 2018 01:00:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C73AE29019 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 11 Sep 2018 01:00:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB4F329020; Tue, 11 Sep 2018 01:00:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B50C29019 for <patchwork-linux-mm@patchwork.kernel.org>; Tue, 11 Sep 2018 01:00:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA9F78E000E; Mon, 10 Sep 2018 21:00:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E5B678E0001; Mon, 10 Sep 2018 21:00:20 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFC6B8E000E; Mon, 10 Sep 2018 21:00:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) by kanga.kvack.org (Postfix) with ESMTP id A4DCE8E0001 for <linux-mm@kvack.org>; Mon, 10 Sep 2018 21:00:20 -0400 (EDT) Received: by mail-yb1-f198.google.com with SMTP id e126-v6so11243329ybb.3 for <linux-mm@kvack.org>; Mon, 10 Sep 2018 18:00:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=AwKU9D2DXjht3CNnkLsSPDqQZuiwRTaiUp/PfPjCECA=; b=W3WwdrwFoQWEn+VRqmYE7omV0HvRiHz6v6/oW1p+8X/mfhmjYMmXcGlQ7a3epkOVfS oPtMKIz6RszgLWwABztjkUWVcHr4Gtz7P3AK7GHtd1RBoYb/XUj5rd+bfNeZPdHxPP4o ghXVU52sy3Ap8oXE8P6voUeGCMqr8xGSQ33Kqic/wu8vxhgfFVpX1qSyd/+lL40arqcB X2GwY2T/23ATrdU+Tc/6cLEc9zHQ13bm3zBfrEmYnSIJm+kqYgk0iUcaZ6xfdGtf7N5x AIGYl1gPsuggVmOV8FhoRGUl3DnuXDYdX9ULAKGsJ6F7Z6sbRLYdJlCE3en9s7tPIEXg ZeBQ== X-Gm-Message-State: APzg51DobphdvmZXfzQC1sB6KFadGhoOk7a5vV0VhSLCchrCi/L6qxkP ZaDmRseiGGrSjoS8TjTED+xs5KonYJuHTEtDmm4rl4BYIjceTGiPtYSo830jWjbTJ9RWroGWrXZ mqhWtS2V1XBdMFYuDL7gtsr1CgM8Aa/JRtPUE6Q2x8EjXt9CHDrEelBnHSzinixm/4A== X-Received: by 2002:a25:9111:: with SMTP id v17-v6mr11664560ybl.120.1536627620417; Mon, 10 Sep 2018 18:00:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYqftAOlT+g05cowslByUlwqS+cq3nj/s2v1wqnWIpL2gtxsRAOnlQRvm+lIyYud0UH+ork X-Received: by 2002:a25:9111:: with SMTP id v17-v6mr11664538ybl.120.1536627619492; Mon, 10 Sep 2018 18:00:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536627619; cv=none; d=google.com; s=arc-20160816; b=JycOcFp+qKb//+BXxdf10epaFwpHpmhr60Ujw1B/HkzeSEH2OTNc2+LVENKvRr4j8o zOS7If/wRYOrM28lkvXg+k/fKHGqL7rXG+Ma57HrrOFnBkMfKh5tCW3eU1CG0BVcGSy1 nmTP181VIaZcXT2O0BbJlszOHn9gFUfu2Kaihd+DBkSrEBKno/dZarnz0Z3PrFv4ALQf rrYmU2KN6lXEgxzB0t+Gcd9A7XiZNXxGjzVTGENEqNRe6ije+Q3o6bs/4cB8Tb+rHP2V DFNldV/SGEkEOgVSlyLLcNQjz1OUYJAX6SBY2/aiLt/2IiqTwL1WhPNAx9qo+iHIWNux N4Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AwKU9D2DXjht3CNnkLsSPDqQZuiwRTaiUp/PfPjCECA=; b=gCclIK1h+URu7IOH+3lFax6h/FFj71X7QvkT5abY/Ge37aAbIwCdzMJtsSZVSv7dGT jGtIJ7B/v1hbLBx+qSFiUcPn4bPA5fu8OvZ5BKo8FkGoQpbsmWTx2VDm1ERzVc/qxzoR 7M8RI4i0Vb1LCUk8StJU4OSu5EGDqYLOko63UQuQDD9L1lPFclsPQ+/Dy66iBT0qZNkK 0Lts2wvwwYQdK3k0cWqxDmhJ6rSo0LDlaGh/MrrwGIIwDZq0EkLaitZGQrR+w/cU5kY3 0Ueqbc0mJlBGf0apFokjfpRdAXv1uTfZ/Fnh1gjAT4Z6v4yi5B0xRyX5mxho6RPN/jCZ 3vEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=XowBvb3w; spf=pass (google.com: domain of daniel.m.jordan@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=daniel.m.jordan@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from userp2130.oracle.com (userp2130.oracle.com. [156.151.31.86]) by mx.google.com with ESMTPS id o14-v6si4000423ybe.678.2018.09.10.18.00.19 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Sep 2018 18:00:19 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.m.jordan@oracle.com designates 156.151.31.86 as permitted sender) client-ip=156.151.31.86; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=XowBvb3w; spf=pass (google.com: domain of daniel.m.jordan@oracle.com designates 156.151.31.86 as permitted sender) smtp.mailfrom=daniel.m.jordan@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8B10AU2077920; Tue, 11 Sep 2018 01:00:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=AwKU9D2DXjht3CNnkLsSPDqQZuiwRTaiUp/PfPjCECA=; b=XowBvb3w4t3VICbk3/jLlxwdY79KT58Jn+A1CG7G2zjjqHd7SajwL523S89WDF807jiE F3tVjJE6B/DQsxJ8x353mkFCpY9rTfDQvBF9u+kpoeD093vmyw79SA6QWDp97UXCbYgv +ZKHuUw2NrnCaHsaVucqMdtDrgwy/7WpOMT+jPV+yvrBxDHC8qpZC0vq0xD3H4pSFrTE tN/FDgjT4JZTTLTglzcN+eFhq4+cUDg36nR0VneX0BrOggnJd4HidnAmuoQCdc6gZ6jn sW1gc9DxC6fTF6s0N38R+/1NlMMY5uFd7ObkNQaj45zzswV8b1K5lvB6/lo+X7f1saZT 2A== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2mc5ut94fq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Sep 2018 01:00:09 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w8B104KL006318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Sep 2018 01:00:04 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8B103xP003465; Tue, 11 Sep 2018 01:00:03 GMT Received: from localhost.localdomain (/73.143.71.164) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Sep 2018 18:00:03 -0700 From: Daniel Jordan <daniel.m.jordan@oracle.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Cc: aaron.lu@intel.com, ak@linux.intel.com, akpm@linux-foundation.org, dave.dice@oracle.com, dave.hansen@linux.intel.com, hannes@cmpxchg.org, levyossi@icloud.com, ldufour@linux.vnet.ibm.com, mgorman@techsingularity.net, mhocko@kernel.org, Pavel.Tatashin@microsoft.com, steven.sistare@oracle.com, tim.c.chen@intel.com, vdavydov.dev@gmail.com, ying.huang@intel.com Subject: [RFC PATCH v2 8/8] mm: enable concurrent LRU adds Date: Mon, 10 Sep 2018 20:59:49 -0400 Message-Id: <20180911005949.5635-5-daniel.m.jordan@oracle.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180911004240.4758-1-daniel.m.jordan@oracle.com> References: <20180911004240.4758-1-daniel.m.jordan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9012 signatures=668708 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-1807170000 definitions=main-1809110009 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: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
lru_lock scalability and SMP list functions
|
expand
|
diff --git a/mm/swap.c b/mm/swap.c index fe3098c09815..ccd82ef3c217 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -999,9 +999,9 @@ void __pagevec_lru_add(struct pagevec *pvec) */ if (pagepgdat != pgdat) { if (pgdat) - write_unlock_irqrestore(&pgdat->lru_lock, flags); + read_unlock_irqrestore(&pgdat->lru_lock, flags); pgdat = pagepgdat; - write_lock_irqsave(&pgdat->lru_lock, flags); + read_lock_irqsave(&pgdat->lru_lock, flags); } lruvec = mem_cgroup_page_lruvec(page, pagepgdat); @@ -1016,12 +1016,16 @@ void __pagevec_lru_add(struct pagevec *pvec) if (splice->pgdat != pgdat) { if (pgdat) - write_unlock_irqrestore(&pgdat->lru_lock, flags); + read_unlock_irqrestore(&pgdat->lru_lock, flags); pgdat = splice->pgdat; - write_lock_irqsave(&pgdat->lru_lock, flags); + read_lock_irqsave(&pgdat->lru_lock, flags); } smp_list_splice(&splice->list, splice->lru); } + if (pgdat) { + read_unlock_irqrestore(&pgdat->lru_lock, flags); + pgdat = NULL; + } while (!list_empty(&singletons)) { page = list_first_entry(&singletons, struct page, lru);
Switch over to holding lru_lock as reader when splicing pages onto the front of an LRU. The main benefit of doing this is to allow LRU adds and removes to happen concurrently. Before this patch, an add blocks all removing threads. Suggested-by: Yosef Lev <levyossi@icloud.com> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com> --- mm/swap.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)