Received: by 10.223.176.46 with SMTP id f43csp2845717wra; Mon, 22 Jan 2018 04:29:06 -0800 (PST) X-Google-Smtp-Source: AH8x224Uw7wkKPpAhazVm0h8PpQlmGabRdeXGZCOz0d6BHQGR8gQPJ/TuYS6r13yfRntKZYP7F9F X-Received: by 2002:a17:902:23:: with SMTP id 32-v6mr3558287pla.350.1516624146210; Mon, 22 Jan 2018 04:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516624146; cv=none; d=google.com; s=arc-20160816; b=JdGrWz85zgALF9krAWbpbBZDQtZhH6wTYJc9BK3j8/g+qp4Qaq44c7wuB9RFd8WNxk 9JCtnlI3NAIjpda0saxm0M4seSSWENUefvRhUdSCtM2sy0IVex5YuVSfFTqqvnXedap5 tM1jc8oERjBSg6QoZCplSojdUAyYTI7l8YqsUlQhMm4EdiA8dzdF7DTQ3eMdCFASMAVd nvHkZqIf4W5eIjHX9wKcDge8b0QAo9NfKVxbIib+J6LQy7w8bxSbiIa8+Yra0j7E8j3n U/lwlFhOhySicttPkTOdWCo+SosCffeumYIp1+vY+FHDII1pTk7FLRhoBl+yVh1I9fr/ nuqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=3ockURLBBL9Qe2+4h/k87C/Ezr016NP4zsOPN6Rh8uE=; b=aGzUEQQAGmKhN/dz8puxDgxRSr2cJnlbtw6Edp8/jim/pQ9gfjcWfxHXpJmmX095nw FIk+aZOtKQUGqGvfqwxi0/uJQlkE8mkm4JuMRMONMn3PCxhlimkYdPYK+Vn9G83eqVXZ pN/yUxSu4LIIw3TQrFD+H0iemPw1hufrXKjSG3thZnBO93qFQSc8ZadvibN3PcaanHrN U7CBhiMOMvlX8LW9dhRZo2EISTPiFQV8gt15EKoVG4zRXp5Qdo/CJHd8q1UUp0/29OuW aQp5xxgCUhumPnJg/abxHj3I2RA1vC+Q61AnykBq7AJe3CnZfpVTPARm2+vI553IatuD HyDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sQKb1uoB; 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=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g6-v6si3414079plp.731.2018.01.22.04.28.52; Mon, 22 Jan 2018 04:29:06 -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=@gmail.com header.s=20161025 header.b=sQKb1uoB; 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=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751216AbeAVM2A (ORCPT + 99 others); Mon, 22 Jan 2018 07:28:00 -0500 Received: from mail-ot0-f178.google.com ([74.125.82.178]:40811 "EHLO mail-ot0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751041AbeAVM17 (ORCPT ); Mon, 22 Jan 2018 07:27:59 -0500 Received: by mail-ot0-f178.google.com with SMTP id x4so7293539otg.7; Mon, 22 Jan 2018 04:27:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3ockURLBBL9Qe2+4h/k87C/Ezr016NP4zsOPN6Rh8uE=; b=sQKb1uoBkmEgewaYUSRdX2Oszp+0NHPXdOEWGEoD/APAA6zEa2MnDy7njH8W5LT/rA uGAM8IoSCcBq6d/hl67kH9tC8tu87qkmanEv4SWI5fJTNI/GH25a1W2pIDkrkyCS+T7O TBVBwuMsBkO5b3ghg+tXigL+xL5TPEvrzEihtv4ujusLKamAwEtLomjVe59TDnZlk7l7 piDFM/2gOAINGCYoWNTf0VKAbm3PNjNFlp9XS23pACTZ17O65NS5On08yCav3jgntGoZ FCFhYLaR8PhefRfbT3HUphFZ8mhNj3nKdrMTFOWXb6D09Czbo0x6dreLepsa7SyII+Gu HuLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3ockURLBBL9Qe2+4h/k87C/Ezr016NP4zsOPN6Rh8uE=; b=g0djnSZjnDpBPMnjVmVoAQQtD4KxCHawiAjmHf+Aco4cMFn9knsr0SOP7Lfp2poACg 1r2Jtz3IwgEWAdAhOqN1BuXBoNnqrwWn2T6WivHlKsZ96O5PiLJJkttTMaHX5YMpnrQe US9tGoIE4PYW2aBmrq7aCNnp9BnXDnqDZ5oU+NAo88Sg+SUplW+ISb/81WmHg43BulTm D2ZqKF4GGYpmG5/nPS254HNZEfS2YYFkxxbWTRoPNaFCdtgmlqvJzSYNtuKFxR2vRljZ NiBPjnShvvcydAYIcDAZ1ua/UlwGPb+NrS7xlMamZsiDfxSqdw/pm6bi6e1Rq0MAN42b 6AAA== X-Gm-Message-State: AKwxytdl+nHhJQTBZ9V80Xvt91GfOuQ2oX9MnMJ6Rb/kkEKb80Atpfy0 Zc4K6MiNwyq58a7uc9BdkRrtIA5udVEnFqwc+vE= X-Received: by 10.157.68.10 with SMTP id u10mr3760259ote.201.1516624078335; Mon, 22 Jan 2018 04:27:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.108.81 with HTTP; Mon, 22 Jan 2018 04:27:58 -0800 (PST) In-Reply-To: <1516622939.24679.5.camel@gmx.de> References: <1516622939.24679.5.camel@gmx.de> From: Wanpeng Li Date: Mon, 22 Jan 2018 20:27:58 +0800 Message-ID: Subject: Re: unixbench context switch perfomance & cpu topology To: Mike Galbraith Cc: linux-kernel@vger.kernel.org, kvm , Paolo Bonzini , Peter Zijlstra , Radim Krcmar , Frederic Weisbecker , Thomas Gleixner , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-01-22 20:08 GMT+08:00 Mike Galbraith : > On Mon, 2018-01-22 at 19:47 +0800, Wanpeng Li wrote: >> Hi all, >> >> We can observe unixbench context switch performance is heavily >> influenced by cpu topology which is exposed to the guest. the score is >> posted below, bigger is better, both the guest and the host kernel are >> 3.15-rc3(we can also reproduce against centos 7.4 693 guest/host), LLC >> is exposed to the guest, kvm adaptive halt-polling is default enabled, >> then start a guest w/ 8 logical cpus. >> >> >> >> unixbench context switch >> -smp 8, sockets=8, cores=1, threads=1 382036 >> -smp 8, sockets=4, cores=2, threads=1 132480 >> -smp 8, sockets=2, cores=4, threads=1 128032 >> -smp 8, sockets=2, cores=2, threads=2 131767 >> -smp 8, sockets=1, cores=4, threads=2 132742 >> -smp 8, sockets=1, cores=4, threads=2 (guest w/ nohz=off idle=poll) 331471 >> >> I can observe there are a lot of reschedule IPIs sent from one vCPU to >> another vCPU, the context switch workload switches between running and >> idle frequently which results in HLT instruction in the idle path, I >> use idle=poll to avoid vmexit due to HLT and to avoid reschedule IPIs >> since idle task checks TIF_NEED_RESCHED flags in a loop, nohz=off can >> stop to program lapic timer/other nohz stuffs. Any idea why sockets=8 >> can get best performance? > > Probably because with that topology, there is no shared llc, thus no > cross-core scheduling, micro-benchmark waker/wakee are stacked. If > your benchmark does nothing but schedule, stacking makes beautiful (but > utterly meaningless) numbers. The waker and wakee are just sporadic on the same logical cpu in the guest(-smp 8, sockets=8, cores=1, threads=1) during the testing, in addition, binding the waker/wakee to one logical cpu in the guest(-smp 8, sockets=1, cores=4, threads=2) also can get the performance as better as 8 sockets setup. Regards, Wanpeng Li