Received: by 10.223.176.5 with SMTP id f5csp940845wra; Tue, 6 Feb 2018 09:49:45 -0800 (PST) X-Google-Smtp-Source: AH8x2265K3O0lXUgkVauaRMlj4c7iCOw8A3w6Kki3OXBTJ1FALAU9NHF3lGoTba8omb2uFypqY4d X-Received: by 10.98.86.78 with SMTP id k75mr3212133pfb.174.1517939385188; Tue, 06 Feb 2018 09:49:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517939385; cv=none; d=google.com; s=arc-20160816; b=OkKiK2bW8pcE0f38RNsf/nyd5q6ITZDKyULK9yFkHjhp3fruKtrg7d77jsd1IcdRy5 PUYyROhGY9zBRiaOSvR5/H6V3GS11deMwDmxaDEQTnCtCz0wB64XhECMmwGDlpEP5BBT J+DniR5v0GSKj9wobMMCYsbL0ga5Eoss2gA9I10K6h6ViYTIJDpGGOyd1CCICUAu+Xxu BQVFyXgMLMCWIXJqmyNkWPVQ1Dus4dJPSV996tOcyoOqZrTn/q+DWZdVfhioVrmtJqbg i9/ZrVu1C1iFIkSm9JlEtMPA/lRs8r1gDekW/uACEDfGx6ZqBtE4MKcXelAp1lPyfz6G kHtA== 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=PYYpk392Ui6pLMypaqc7QrjmZmBvwPYvY5YCzh1ehdg=; b=m69m3xe04iun2RZr8ChFXZVzw6lOULua7etO/QnHEAuSXFbLIv2aoi3arzF25dwD9e hSxyQ2JmkU5GUig11VfxPf5U1xfRd8fqReq9UIkr8QTeSQlSiVhmVQ4CeBrzly677ivl NgeOpAwnKHdEXrtpTZb0uRvlYjxW12IcmrY/Fbp8/opMFcy60ldjBtbqh4pUf/8kyJm8 wEPa0ijNOaQ/DttTiJu0FJeCKc5JF9mn+scgKWZEWslo7ZL1ZMo6rC1X9XmqEdkYu3RV 7GHA3/zmLm95ydccCkYN546LaGuETRJVa+pP2ccB09/RCLoiTsquirvPX6m/b3m19vGB Pcqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Bzmg2uVd; 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 b23si3097612pfm.56.2018.02.06.09.49.31; Tue, 06 Feb 2018 09:49:45 -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=Bzmg2uVd; 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 S1752720AbeBFRr4 (ORCPT + 99 others); Tue, 6 Feb 2018 12:47:56 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:53514 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752658AbeBFRro (ORCPT ); Tue, 6 Feb 2018 12:47:44 -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 w16HlYWQ065675; Tue, 6 Feb 2018 17:47:34 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=PYYpk392Ui6pLMypaqc7QrjmZmBvwPYvY5YCzh1ehdg=; b=Bzmg2uVd7DsC+kq4zearnAV4TD49rtqTM3Nhwnqler4SbQC74NLoDTX++eYsYYcIRdRB 9o0FvWPiezDJKwMaOd83145nHW6fuAl72l3medLL5FKdKy6CJsxG2D31LKwJpVrxhOGp KgJo3FkK2IhWfDYMUDngLWqcJV88y7Zjr/f6UYrkUVPJjw6szs2euDl28p4IZxJ0AJk1 Mxc0UkyPJnIVNcWss0JWvwkuKwet1104nrM8r/RkZjP9kjcg+j8WfqF5hZQYABk5N31p AHuhIlB6Jd+V7viKnsMkUR28HT/h0UWvwiBizahqBmpQgK0l9lHJ58G+p103ocCi94f3 ug== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp2130.oracle.com with ESMTP id 2fyfxm8j20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Feb 2018 17:47:34 +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 w16HlYbo009430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Feb 2018 17:47:34 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w16HlWF3002445; Tue, 6 Feb 2018 17:47:32 GMT Received: from [10.159.143.50] (/10.159.143.50) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 06 Feb 2018 09:47:32 -0800 Subject: Re: [RFC PATCH v1 12/13] mm: split up release_pages into non-sentinel and sentinel passes To: Laurent Dufour , 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, 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> <20180131230413.27653-13-daniel.m.jordan@oracle.com> <3287f5ca-ab17-6437-c0fd-b867d90f8c1f@linux.vnet.ibm.com> <8a56da6b-8a47-3dc9-9b01-eb92be9fd828@linux.vnet.ibm.com> From: Daniel Jordan Organization: Oracle Corporation Message-ID: Date: Tue, 6 Feb 2018 12:47:54 -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: <8a56da6b-8a47-3dc9-9b01-eb92be9fd828@linux.vnet.ibm.com> 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=8796 signatures=668662 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-1802060225 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/02/2018 12:00 PM, Laurent Dufour wrote: > On 02/02/2018 15:40, Laurent Dufour wrote: >> >> >> On 01/02/2018 00:04, daniel.m.jordan@oracle.com wrote: >>> A common case in release_pages is for the 'pages' list to be in roughly >>> the same order as they are in their LRU. With LRU batch locking, when a >>> sentinel page is removed, an adjacent non-sentinel page must be promoted >>> to a sentinel page to follow the locking scheme. So we can get behavior >>> where nearly every page in the 'pages' array is treated as a sentinel >>> page, hurting the scalability of this approach. >>> >>> To address this, split up release_pages into non-sentinel and sentinel >>> passes so that the non-sentinel pages can be locked with an LRU batch >>> lock before the sentinel pages are removed. >>> >>> For the prototype, just use a bitmap and a temporary outer loop to >>> implement this. >>> >>> Performance numbers from a single microbenchmark at this point in the >>> series are included in the next patch. >>> >>> Signed-off-by: Daniel Jordan >>> --- >>> mm/swap.c | 20 +++++++++++++++++++- >>> 1 file changed, 19 insertions(+), 1 deletion(-) >>> >>> diff --git a/mm/swap.c b/mm/swap.c >>> index fae766e035a4..a302224293ad 100644 >>> --- a/mm/swap.c >>> +++ b/mm/swap.c >>> @@ -731,6 +731,7 @@ void lru_add_drain_all(void) >>> put_online_cpus(); >>> } >>> >>> +#define LRU_BITMAP_SIZE 512 >>> /** >>> * release_pages - batched put_page() >>> * @pages: array of pages to release >>> @@ -742,16 +743,32 @@ void lru_add_drain_all(void) >>> */ >>> void release_pages(struct page **pages, int nr) >>> { >>> - int i; >>> + int h, i; >>> LIST_HEAD(pages_to_free); >>> struct pglist_data *locked_pgdat = NULL; >>> spinlock_t *locked_lru_batch = NULL; >>> struct lruvec *lruvec; >>> unsigned long uninitialized_var(flags); >>> + DECLARE_BITMAP(lru_bitmap, LRU_BITMAP_SIZE); >>> + >>> + VM_BUG_ON(nr > LRU_BITMAP_SIZE); >> >> While running your series rebased on v4.15-mmotm-2018-01-31-16-51, I'm >> hitting this VM_BUG sometimes on a ppc64 system where page size is set to 64K. > > I can't see any link between nr and LRU_BITMAP_SIZE, caller may pass a > larger list of pages which is not relative to the LRU list. You're correct, I used the hard-coded size to quickly prototype, just to see how this approach performs. That's unfortunate that it bit you. > To move forward seeing the benefit of this series with the SPF one, I > declared the bit map based on nr. This is still not a valid option but this > at least allows to process all the passed pages. Yes, the bitmap's not for the final version.