Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp901926imu; Mon, 5 Nov 2018 10:28:51 -0800 (PST) X-Google-Smtp-Source: AJdET5dmhxTcEAeXT8ZxovZP9gOtdSSrq+cbf5rtmh4svHVTOqElfahwZg8bVhg0bG+bU240GDRT X-Received: by 2002:a63:4a0a:: with SMTP id x10mr9916827pga.237.1541442531684; Mon, 05 Nov 2018 10:28:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541442531; cv=none; d=google.com; s=arc-20160816; b=09Rd3WEJLBw/4/0OdqG8gAQcq5H9F/DkUENi/9Z3jRSpwEFuC0EsD6x0+5OwzFOUME VUh/dwW6pVPWuAkMrGgQhky8vSoMxOVoHvtVc2exAoLMWCgbJg5jT2DneT8NuUgIxhvP CHq7+8UGR4FGn0GmWZJkmOoImRq2oLwoPdXmO/1nafoRbdefO7eqUjupWwQpVLCI23eG nBshIJ4KGy/Q7owQQr1v0n9+5Aty0RWbATBqZYHj8+essKVA9PCBAyQL+Q76gKRa4s9i MM1JQYX1V2ZVbm3hOvZLMczP8VCIDrRAUFdQgChjs3d/lQ3XYbbFaK8Qz/zkmjbTddjq MQLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=F9ly9jgaibAQRBT+gTutp2zIFUxUPtaPa7/C7xB28BM=; b=LiKST3SKr2QZQSIy8bkP1TP0I2QfQY/32nnUhTpdXdQIEFaEWeUP2pwIx26KL3uHg4 xlk7zOuZbq1y1MmKq7FMmmWbbcar3rDgTP+AGD+HUXj0XD1fOa/7AVgfpaz8odsz6JTu kQRBt/apKf5etApYOd3EQ/YdC3IfVFgufxnmcUeG5rIYtczpkg7L4QETdBQIdNLQkx0f 9K/AvzeDgqBQA43rN2T/K+ACvHu2uUB5ZcOa1rO3qi3T23VMeRiovfpfSMvRu5OSaY+1 O5dklsw4sqIhZi1vMNTJ9/NipWyo3+rECLJfrUqj7G1I9BjX4Va95GMD5W5l8ekb994k jgMA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bd6-v6si18115629plb.399.2018.11.05.10.28.35; Mon, 05 Nov 2018 10:28:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729304AbeKFDtK (ORCPT + 99 others); Mon, 5 Nov 2018 22:49:10 -0500 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:55928 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbeKFDtK (ORCPT ); Mon, 5 Nov 2018 22:49:10 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0TCLNb8u_1541442487; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TCLNb8u_1541442487) by smtp.aliyun-inc.com(127.0.0.1); Tue, 06 Nov 2018 02:28:11 +0800 Subject: Re: [LKP] [mm] 9bc8039e71: will-it-scale.per_thread_ops -64.1% regression To: Linus Torvalds , rong.a.chen@intel.com, vbabka@suse.cz, kirill.shutemov@linux.intel.com, mhocko@kernel.org, willy@infradead.org, ldufour@linux.vnet.ibm.com, Andrew Morton Cc: Colin King , Linux Kernel Mailing List , lkp@01.org References: <20181105050813.GP24195@shao2-debian> From: Yang Shi Message-ID: <4feae9c4-432d-a362-58e4-11e0cb10b24d@linux.alibaba.com> Date: Mon, 5 Nov 2018 10:28:02 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/5/18 9:50 AM, Linus Torvalds wrote: > On Sun, Nov 4, 2018 at 9:08 PM kernel test robot wrote: >> FYI, we noticed a -64.1% regression of will-it-scale.per_thread_ops >> due to commit 9bc8039e715d ("mm: brk: downgrade mmap_sem to read when >> shrinking") > Ugh. That looks pretty bad. > >> in testcase: will-it-scale >> on test machine: 8 threads Ivy Bridge with 16G memory >> with following parameters: >> >> nr_task: 100% >> mode: thread >> test: brk1 >> ucode: 0x20 >> cpufreq_governor: performance > The reason seems to be way more scheduler time due to lots more > context switches: > >> 34925294 ± 18% +270.3% 1.293e+08 ± 4% will-it-scale.time.voluntary_context_switches > Yang Shi, would you mind taking a look at what's going on? No problem. Actually, the commit is mainly for optimizing the long stall time caused by holding mmap_sem by write when unmapping or shrinking large mapping. It downgrades write mmap_sem to read when zapping pages. So, it looks the downgrade incurs more context switches. This is kind of expected. However, the test looks just shrink the mapping with one normal 4K page size. It sounds the overhead of context switches outpace the gain in this case at the first glance. Since the optimization makes more sense to large mapping, how about restore the mapping size limit, e.g. just downgrade mmap_sem for >= 1g (PUD_SIZE) mapping? Thanks, Yang > > Linus