Received: by 10.223.185.116 with SMTP id b49csp8356160wrg; Thu, 1 Mar 2018 23:43:41 -0800 (PST) X-Google-Smtp-Source: AG47ELv4KGa7HqMTGXeRJRCrloz2AVChq2/wjOt4CAC0Q4muAS5h1wldtNnI4y1RUBYEtsJ8JQcV X-Received: by 10.99.160.17 with SMTP id r17mr3871542pge.127.1519976621737; Thu, 01 Mar 2018 23:43:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519976621; cv=none; d=google.com; s=arc-20160816; b=fkSX4oW9pKk7cwQa7qrvlugeng20b+NYTUkWFClNZHk0fSuxUxLGCJ6l6YxkVJjVA2 yzo84tXlA1I5ZFkpi/lt1N7m7OckNgh1umA499pB30t3xTxy/gUO1j5wnK6G680T7HUf qzA0S5LB7ph3lw2Z//0HUpe3gPVQ4FFzIvCUYUHtq7mcbhpsUPEa530n9PyFL8PByWr9 7Na/wY1crSlgHNeb7vR8CVswg3BCo2utF+4JI5HUqs5moVHV8SEODlWoDDdTXlmovcdB QiSpLh0jJ+BTaSGpo2+MFxdGDSoUgt2eGXuVUKR7uCb2TPW9H0hYM2M/rkE+Uvx2K4O+ SLhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=l848yzfy9GnlTkQTVb+HaCI/+CBTslkHWmzGXSZFf14=; b=o7zgKHWyPcBeiCtnrkg/mShs3In3s2PmeJDTq9RXdbti/w9oB8pFFi0Ro15yb/OZmV degU/x0JmcPWZ6T0ypekBIRrAV0xF6tIjgY1XtDoQ9ckUEKoBvyfUgCRVcEr5xVbddx9 X7oyqZ2zF6lqlYjlMRCdNrtILnngD9ph5YkBmyVi5gVt8uHOGCzMGlOEDh1EtkWydDKc FZbsjIOz5fSgUoIAUD4RvF49TySa1WULFC7bSQgebtCF1J4EutEWkwTi3WFaLKRSV1Wl TqI3GK/w/psMDigIhD0A3m+L83/gluFrEOaMJmMpBXCp2BFbY1LRCbKp4D6tWQntubcj aNFA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19si3636055pgc.353.2018.03.01.23.43.14; Thu, 01 Mar 2018 23:43:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936129AbeCBHbs (ORCPT + 99 others); Fri, 2 Mar 2018 02:31:48 -0500 Received: from mga18.intel.com ([134.134.136.126]:46928 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935717AbeCBHbo (ORCPT ); Fri, 2 Mar 2018 02:31:44 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2018 23:31:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,411,1515484800"; d="scan'208";a="22274212" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.13.10]) by orsmga006.jf.intel.com with ESMTP; 01 Mar 2018 23:31:41 -0800 From: "Huang\, Ying" To: Michal Hocko Cc: Aaron Lu , , , Andrew Morton , Dave Hansen , Kemi Wang , Tim Chen , Andi Kleen , "Vlastimil Babka" , Mel Gorman , "Matthew Wilcox" , David Rientjes Subject: Re: [PATCH v4 2/3] mm/free_pcppages_bulk: do not hold lock when picking pages to free References: <20180301062845.26038-1-aaron.lu@intel.com> <20180301062845.26038-3-aaron.lu@intel.com> <20180301135518.GJ15057@dhcp22.suse.cz> Date: Fri, 02 Mar 2018 15:31:40 +0800 In-Reply-To: <20180301135518.GJ15057@dhcp22.suse.cz> (Michal Hocko's message of "Thu, 1 Mar 2018 14:55:18 +0100") Message-ID: <87r2p3c4rn.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal Hocko writes: > On Thu 01-03-18 14:28:44, Aaron Lu wrote: >> When freeing a batch of pages from Per-CPU-Pages(PCP) back to buddy, >> the zone->lock is held and then pages are chosen from PCP's migratetype >> list. While there is actually no need to do this 'choose part' under >> lock since it's PCP pages, the only CPU that can touch them is us and >> irq is also disabled. >> >> Moving this part outside could reduce lock held time and improve >> performance. Test with will-it-scale/page_fault1 full load: >> >> kernel Broadwell(2S) Skylake(2S) Broadwell(4S) Skylake(4S) >> v4.16-rc2+ 9034215 7971818 13667135 15677465 >> this patch 9536374 +5.6% 8314710 +4.3% 14070408 +3.0% 16675866 +6.4% >> >> What the test does is: starts $nr_cpu processes and each will repeatedly >> do the following for 5 minutes: >> 1 mmap 128M anonymouse space; >> 2 write access to that space; >> 3 munmap. >> The score is the aggregated iteration. > > Iteration count I assume. I am still quite surprised that this would > have such a large impact. The test is run with full load, this means near or more than 100 processes will allocate memory in parallel. According to Amdahl's law, the performance of a parallel program will be dominated by the serial part. For this case, the part protected by zone->lock. So small changes to code under zone->lock could make bigger changes to overall score. Best Regards, Huang, Ying