Received: by 10.223.176.5 with SMTP id f5csp2025484wra; Wed, 31 Jan 2018 15:28:17 -0800 (PST) X-Google-Smtp-Source: AH8x225SJ5921gDsmJ2joGDfNGRg7RjDo/plucMiY+8P2u07hpihpZSCrR1t3jdxs1BcmvI4yLpB X-Received: by 2002:a17:902:5a3:: with SMTP id f32-v6mr30366335plf.48.1517441297515; Wed, 31 Jan 2018 15:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517441297; cv=none; d=google.com; s=arc-20160816; b=Wwx9zNJc9oz7SAm+o+tLEh2qLP+SMibznhFUMJsQaQ8QBICrwa4O2TL5xpnsrLfTjt l5A8r947cDrHG0Hf1kc4UVRChiUohjMlkIUZjD2Kh9lYDeMvwk7wicmNiHmS43GoP4Rf ba8EXGjYOjmkvoK+ZDLCBR40LsTrM1iIoqQYjWFX2ZTgOVhBFFCdJXJTN+B5kAvX6kOa 048jAJarGK7X4WfPK/jWAdNcp29dTBoc7bBCj4zesCrOXZ6QQWO2d+2FYOg+pkGPY3qh Q9dFbeo5WbeNpd/fcT6DScPlHeB6NRsqdhceoFXj1crAE8q3HDKhqsL5Wr91NLg+QsNW EZLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=U/BqE0HiaLUWDo5yd5jVQnzfQ6wEO0quwj9jxvE2RuE=; b=1J2u8AVCABauBxuY1v6eg7NRFM2hpT8XE5xhWUJW0/QwFt5gshr8WBGgyw5x76BqLe 8MvBQAHbo2VeYtyauMc9OTa/DUmkmZuNgH0JTOnOdVWIVuXkNJKpiLqkkx7CJCUz3A+Q If8AZwn7nEaeDhqNHSaRnBzn65cyT1O7cQ/Po3oyen0EZtvtdjJTcKqqHdvJQ193dvMk fTK61TR3ArCgj8V8i725Gbd9Zb3ZVvKLdsKOcBH6PvfScT1/BvFleuCShPB1fjVtAmRR NNdJoJRRO5lkI0LsPcHYeh5nlDCkQFvvu2mJyg8F03BWex6nShNaLU3zIC6da6xspzGw Q3eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=a7596eBC; 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 s24-v6si3110763plp.291.2018.01.31.15.28.02; Wed, 31 Jan 2018 15:28:17 -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=a7596eBC; 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 S932107AbeAaXLu (ORCPT + 99 others); Wed, 31 Jan 2018 18:11:50 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:46378 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754373AbeAaXFn (ORCPT ); Wed, 31 Jan 2018 18:05:43 -0500 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 w0VMpjrS145395; Wed, 31 Jan 2018 23:04:33 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-2017-10-26; bh=U/BqE0HiaLUWDo5yd5jVQnzfQ6wEO0quwj9jxvE2RuE=; b=a7596eBCgWIoERz7JPms/FGj+1+bz/m5RznUbSsAeUVPaMQg40oklxKMltlNE30p9ZCK 9sBCLQ7+zqqLFLk88X6ouN1VhaSGvf8uYy9ZtAb8mLX5nqfDrXC9QxVPcsXytzbryk55 PaftpujMswqT3b/VkP8HAbo6Ht7XEHxMgRMuJ6q2wEW9nEHDIvoUlMGVNEQXlW0C8Khx G0uKD3o73FS4hPZKd3aZFPRStFjhUtNSk2H1B6mJy7HrwzX2oxj7jqL1q/pGy8N3GzSS j23P8z4G6uSx60vdEQasCdHekOoh/emV98RWT2QqdxQX5f3I+IG4aiNiho0YHyH+Reni aQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2fujpm98th-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 31 Jan 2018 23:04:32 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w0VN4WIO021845 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 31 Jan 2018 23:04:32 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w0VN4Va7022392; Wed, 31 Jan 2018 23:04:32 GMT Received: from parnassus.us.oracle.com (/10.39.213.30) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 31 Jan 2018 15:04:31 -0800 From: daniel.m.jordan@oracle.com To: 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 Subject: [RFC PATCH v1 09/13] mm: introduce add-only version of pagevec_lru_move_fn Date: Wed, 31 Jan 2018 18:04:09 -0500 Message-Id: <20180131230413.27653-10-daniel.m.jordan@oracle.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180131230413.27653-1-daniel.m.jordan@oracle.com> References: <20180131230413.27653-1-daniel.m.jordan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8791 signatures=668659 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=957 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801310283 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For the purposes of this prototype, copy the body of pagevec_lru_move_fn into __pagevec_lru_add so that it can be modified to use the batch locking API while leaving all other callers of pagevec_lru_move_fn unaffected. Signed-off-by: Daniel Jordan --- mm/swap.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/mm/swap.c b/mm/swap.c index cf6a59f2cad6..2bb28fcb7cc0 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -902,7 +902,29 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, */ void __pagevec_lru_add(struct pagevec *pvec) { - pagevec_lru_move_fn(pvec, __pagevec_lru_add_fn, NULL); + int i; + struct pglist_data *pgdat = NULL; + struct lruvec *lruvec; + unsigned long flags = 0; + + for (i = 0; i < pagevec_count(pvec); i++) { + struct page *page = pvec->pages[i]; + struct pglist_data *pagepgdat = page_pgdat(page); + + if (pagepgdat != pgdat) { + if (pgdat) + spin_unlock_irqrestore(&pgdat->lru_lock, flags); + pgdat = pagepgdat; + spin_lock_irqsave(&pgdat->lru_lock, flags); + } + + lruvec = mem_cgroup_page_lruvec(page, pgdat); + __pagevec_lru_add_fn(page, lruvec, NULL); + } + if (pgdat) + spin_unlock_irqrestore(&pgdat->lru_lock, flags); + release_pages(pvec->pages, pvec->nr); + pagevec_reinit(pvec); } EXPORT_SYMBOL(__pagevec_lru_add); -- 2.16.1