Received: by 10.223.176.5 with SMTP id f5csp286864wra; Thu, 1 Feb 2018 20:30:56 -0800 (PST) X-Google-Smtp-Source: AH8x227c4ECCFORNjoJbFhB2OnHZ/ZW79tSBVLs2XVOOgq9VoNsHhLLc2KVM4KpBFiZTWIXZV5Ja X-Received: by 2002:a17:902:523:: with SMTP id 32-v6mr26364827plf.283.1517545856495; Thu, 01 Feb 2018 20:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517545856; cv=none; d=google.com; s=arc-20160816; b=WEoCtiF+spuhlYzmgXk1k8NqTTUNEBEDlRyzeFLCOdfGZwhBcXWGnApsan6j48P/Fs yuO1DgHGXc4lm59IoqEJ3VpbkLDevM74XUKdkI5eOMDbw41X2/iLjScHB1APa6vRMYq+ MZKsc90rECkXDfZ5mniMelWUs+dEGw7aqW7JiaXcI7LzCnm1S2N01ufR74es3jdouwzv MNiL2uOTnGKLjGAM2jygmHzpswUCqF13tRAjUFzyqBrM4jPE06Ei6rLDMibdkVPU388l FtAdoa5kqqMwXRgQHrUF7OiAGrTXiQWRL7/8T0Qb1bnmXt9EJ0P83/PreDSZKUlCQHHc A1BQ== 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=+ZcfWaX/sfSFjmnvnil3osPXiHvtu8IWChpykucQQR4=; b=HrqSkkoEaVOThvV/lYGIwQp3EG3f3dZWRqGA1pLt4F0wc/sC9beizOTb/TQW9VAOWM H8PBvpCNgOQIHdbTeTjB4WK9FjIKsN0Xh4XwFgOrZ0pVCx12x0WCfSdyB116bq+/VA/2 RmstcqgOu+MxV9fL0AxLPZSyIj/th7XnfrqnIfF1FPgTSVFbw9bC7VOdyI+6Fm5IF2xL VwZg9dbYWz+38SVsgQVcT4e/7D8FqtVimumplDYTTcgr71Xx5SPsZ7P+JSTDqnKqWkGy D1DtZoIOaV2f3vfFCMmg5tNmT8x52Ul9IfXAZSc5EZpu44rIP1CJEUbyfqV1XawTNiNc +5bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=in43afqG; 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 a15si830615pgd.21.2018.02.01.20.30.30; Thu, 01 Feb 2018 20:30:56 -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=in43afqG; 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 S1751738AbeBBE3x (ORCPT + 99 others); Thu, 1 Feb 2018 23:29:53 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:41978 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbeBBE3t (ORCPT ); Thu, 1 Feb 2018 23:29:49 -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 w124RWB6008870; Fri, 2 Feb 2018 04:29:38 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=+ZcfWaX/sfSFjmnvnil3osPXiHvtu8IWChpykucQQR4=; b=in43afqGVwEDe3bU2iPciOl/OtmxZ8OhtvdGAPOUKuGG1xCwBpuV7teMtHPgdbiTWJXs htjTwbogDFYj1RkaAx2R3nTxt8RyWUSK+6axr/19OyohflyPVNN6jiszHMLBjM0IWu8Q npp5xWy283nkNkeTI/mQv7tgU+nylz0UVsvePbZXJ+okjGHb5f6NZRaR1vJo7B1BY1v9 cN7JpdE6Vr8Itrqp/QjEYeKS/ZXBrmSFlhh+WAuiSP/UvDFz5tp+jS/1m35Y6Mf869jV GU+0yu5ZgyhISM5z0L8Lhn+h0D0/GjsRAG6YKBlVgpUEOHyDC+/BZc8c07xRnC1jmB2S uw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2fvg4tg3su-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 02 Feb 2018 04:29:38 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w124TbXV022076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 2 Feb 2018 04:29:38 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w124TaTD009401; Fri, 2 Feb 2018 04:29:36 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:29:36 -0800 Subject: Re: [RFC PATCH v1 03/13] mm: add lock array to pgdat and batch fields to struct page To: Tim Chen , 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> <20180131230413.27653-4-daniel.m.jordan@oracle.com> <64330116-13ef-af3c-a445-f0c1b5bc1728@linux.intel.com> From: Daniel Jordan Message-ID: <02b757a9-5b06-51a5-a3e1-5cbc06a79996@oracle.com> Date: Thu, 1 Feb 2018 23:29:30 -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: <64330116-13ef-af3c-a445-f0c1b5bc1728@linux.intel.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=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-1802020044 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/01/2018 05:50 PM, Tim Chen wrote: > On 01/31/2018 03:04 PM, daniel.m.jordan@oracle.com wrote: >> This patch simply adds the array of locks and struct page fields. >> Ignore for now where the struct page fields are: we need to find a place >> to put them that doesn't enlarge the struct. >> >> Signed-off-by: Daniel Jordan >> --- >> include/linux/mm_types.h | 5 +++++ >> include/linux/mmzone.h | 7 +++++++ >> mm/page_alloc.c | 3 +++ >> 3 files changed, 15 insertions(+) >> >> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h >> index cfd0ac4e5e0e..6e9d26f0cecf 100644 >> --- a/include/linux/mm_types.h >> +++ b/include/linux/mm_types.h >> @@ -190,6 +190,11 @@ struct page { >> struct kmem_cache *slab_cache; /* SL[AU]B: Pointer to slab */ >> }; >> >> + struct { >> + unsigned lru_batch; >> + bool lru_sentinel; > > The above declaration adds at least 5 bytes to struct page. > It adds a lot of extra memory overhead when multiplied > by the number of pages in the system. Yes, I completely agree, enlarging struct page won't cut it for the final solution. > We can move sentinel bool to page flag, at least for 64 bit system. There did seem to be room for one more bit the way my kernel was configured (without losing a component in page->flags), but I'd have to look again. > And 8 bit is probably enough for lru_batch id to give a max > lru_batch number of 256 to break the locks into 256 smaller ones. > The max used in the patchset is 32 and that is already giving > pretty good spread of the locking. > It will be better if we can find some unused space in struct page > to squeeze it in. One idea we'd had was to store the batch id in the lower bits of the mem_cgroup pointer. CONFIG_MEMCG seems to be pretty ubiquitous these days, and it's a large enough struct (1048 bytes on one machine) to have room in the lower bits. Another way might be to encode the previous and next lru page pointers as pfn's instead of struct list_head *'s, shrinking the footprint of struct page's lru field to allow room for the batch id.