Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1012650imu; Mon, 5 Nov 2018 12:19:12 -0800 (PST) X-Google-Smtp-Source: AJdET5cZY4adT1r7+FWC1hwE1BiOfbYDgDrMrbxO9jGXuqDiEHS8SnwdRCLQ2Qf8FcNiy+uJaeTQ X-Received: by 2002:a17:902:e81:: with SMTP id 1-v6mr23406897plx.48.1541449152006; Mon, 05 Nov 2018 12:19:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541449151; cv=none; d=google.com; s=arc-20160816; b=rwev2dSFOdjAhbRDkCljwkWJ5d/FjCE2FKXerFjV6KwpZWT5kBp7bd0zt9/xxVnPjx YOg10GmVqPyYZs/ExxBjuDphoaH47uJtksYYEnEYcfAxXWOLzb+cUSM/D8RXQct3/LS2 n+CDxQn6XW0kRTyv1wPK2+zok53j+W0Y9MbIcJI9cIH66xa8XOHvpAY8U9q19hyrUKiQ geFwcwIUoqFaeBfajoYVsC3bzGUWKjqpulbNS4klF8sLl2vzlrGVD/TsQXXp3fhm5OWZ KvR8yX7qDUw3wbwjJRKdKvoZIey/+VRFPlA5gu1Zv2Wj2sJsZTyb0eSxxZz3cJfLt8Dg EnrQ== 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=F8DH8oIeRqAkLXp1vGm16T5U0o9UxEuNutSsFTcCqa8=; b=WgZQ2Eo8aNvH59SDdmkea1tgEhV11WEXAY3MX1X0qR3I8ENJtwzGvavdPExYXRglJm Cd2i2B43AA/IZkGg6DXGp7ob1JMpArHiuswebEeWeRCT1wElH2x9BUvX9TJxryow69jR ipbDCSvObCPRMC5CXbgsrFo43XZfKmcisSPlJvPn8/xDFij6qZZ1biapVoH7+OIhDQVA ephf6TvVbJem++MILMYv3aVArO+cjEv2rjaQYL6DRW7dgPdiizUcFlQ/Mm8wK4AQYQmd IO+nMky9WWlTtZtwFn8dk1c+9U8Rp1Q8JtB/rh9CWdxaFzC3KhyArGWf+91yxY1CvPwM 5nLg== 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 l6si6664454pgr.326.2018.11.05.12.18.56; Mon, 05 Nov 2018 12:19:11 -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 S1730287AbeKFFjf (ORCPT + 99 others); Tue, 6 Nov 2018 00:39:35 -0500 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:47171 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730109AbeKFFje (ORCPT ); Tue, 6 Nov 2018 00:39:34 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07417;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0TCLNr4G_1541449084; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TCLNr4G_1541449084) by smtp.aliyun-inc.com(127.0.0.1); Tue, 06 Nov 2018 04:18:08 +0800 Subject: Re: [LKP] [mm] 9bc8039e71: will-it-scale.per_thread_ops -64.1% regression To: Linus Torvalds Cc: rong.a.chen@intel.com, vbabka@suse.cz, kirill.shutemov@linux.intel.com, mhocko@kernel.org, Matthew Wilcox , ldufour@linux.vnet.ibm.com, Andrew Morton , Colin King , Linux Kernel Mailing List , lkp@01.org References: <20181105050813.GP24195@shao2-debian> <4feae9c4-432d-a362-58e4-11e0cb10b24d@linux.alibaba.com> From: Yang Shi Message-ID: <51265121-6e54-ff3a-cdfa-e5a2b838268d@linux.alibaba.com> Date: Mon, 5 Nov 2018 12:17:59 -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 10:35 AM, Linus Torvalds wrote: > On Mon, Nov 5, 2018 at 10:28 AM Yang Shi wrote: >> 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. > I'm not seeing why there should be a context switch in the first place. > > Even if you have lots of concurrent brk() users, they should all block > exactly the same way as before (a write lock blocks against a write > lock, but it *also* blocks against a downgraded read lock). Yes, it is true. The brk() users will not get waken up. What I can think of for now is there might be other helper processes and/or kernel threads are waiting for read mmap_sem. They might get waken up by the downgrade. But, I also saw huge increase in cpu idle time and sched_goidle events. Not have clue yet for why idle goes up. 20610709 ± 15% +2376.0% 5.103e+08 ± 34% cpuidle.C1.time 28753819 ± 39% +1054.5% 3.319e+08 ± 49% cpuidle.C3.time 175049 ± 72% +840.7% 1646720 ± 72% sched_debug.cpu.sched_goidle.stddev Thanks, Yang > > So no, I don't want just some limit to hide this problem for that > particular test. There's something else going on. > > Linus