Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753903AbbKWJl6 (ORCPT ); Mon, 23 Nov 2015 04:41:58 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35298 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751924AbbKWJl4 (ORCPT ); Mon, 23 Nov 2015 04:41:56 -0500 MIME-Version: 1.0 In-Reply-To: <563CE5A6.8080409@hpe.com> References: <563B8E85.6090104@hpe.com> <563CE5A6.8080409@hpe.com> Date: Mon, 23 Nov 2015 17:41:54 +0800 Message-ID: Subject: Re: Improve spinlock performance by moving work to one core From: Ling Ma To: Waiman Long Cc: Peter Zijlstra , mingo@redhat.com, linux-kernel@vger.kernel.org, Ling Content-Type: multipart/mixed; boundary=001a114b30741b3f360525320996 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 38201 Lines: 534 --001a114b30741b3f360525320996 Content-Type: text/plain; charset=UTF-8 Hi Longman, Attachments include user space application thread.c and kernel patch spinlock-test.patch based on kernel 4.3.0-rc4 we run thread.c with kernel patch, test original and new spinlock respectively, perf top -G indicates thread.c cause cache_alloc_refill and cache_flusharray functions to spend ~25% time on original spinlock, after introducing new spinlock in two functions, the cost time become ~22%. The printed data also tell us the new spinlock improves performance by about 15%( 93841765576 / 81036259588) on E5-2699V3 Appreciate your comments. Thanks Ling 2015-11-07 1:38 GMT+08:00 Waiman Long : > > On 11/05/2015 11:28 PM, Ling Ma wrote: >> >> Longman >> >> Thanks for your suggestion. >> We will look for real scenario to test, and could you please introduce >> some benchmarks on spinlock ? >> >> Regards >> Ling >> >> > > The kernel has been well optimized for most common workloads that spinlock contention is usually not a performance bottleneck. There are still corner cases where there is heavy spinlock contention. > > I used a spinlock loop microbenchmark like what you are doing as well as AIM7 for application level testing. > > Cheers, > Longman > > --001a114b30741b3f360525320996 Content-Type: application/octet-stream; name="spinlock-test.patch" Content-Disposition: attachment; filename="spinlock-test.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ihbrb22i0 RnJvbSA4ODRlMmIwMjJhNDNlMzFlMzhmMzc3OWE5ZWUzMTdjMzBlMmE1ZTE3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiByb290IDxyb290QGxvY2FsaG9zdC5sb2NhbGRvbWFpbj4KRGF0 ZTogTW9uLCAyMyBOb3YgMjAxNSAxNjo1Nzo1NCArMDgwMApTdWJqZWN0OiBbUEFUQ0hdIHNwaW5s b2NrLXRlc3QKCi0tLQogaW5jbHVkZS9hc20tZ2VuZXJpYy9xc3BpbmxvY2suaCB8ICAgIDUgKy0K IGluY2x1ZGUvbGludXgvc2xhYl9sb2NrLmggICAgICAgfCAgNjA5ICsrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKwogbW0vc2xhYi5jICAgICAgICAgICAgICAgICAgICAgICB8 ICAyMTQgKysrKysrKysrLS0tLS0KIDMgZmlsZXMgY2hhbmdlZCwgNzQ4IGluc2VydGlvbnMoKyks IDgwIGRlbGV0aW9ucygtKQogY3JlYXRlIG1vZGUgMTAwNjQ0IGluY2x1ZGUvbGludXgvc2xhYl9s b2NrLmgKCmRpZmYgLS1naXQgYS9pbmNsdWRlL2FzbS1nZW5lcmljL3FzcGlubG9jay5oIGIvaW5j bHVkZS9hc20tZ2VuZXJpYy9xc3BpbmxvY2suaAppbmRleCBlMmFhZGJjLi41ZDY1YjBmIDEwMDY0 NAotLS0gYS9pbmNsdWRlL2FzbS1nZW5lcmljL3FzcGlubG9jay5oCisrKyBiL2luY2x1ZGUvYXNt LWdlbmVyaWMvcXNwaW5sb2NrLmgKQEAgLTc2LDExICs3NiwxMiBAQCBleHRlcm4gdm9pZCBxdWV1 ZWRfc3Bpbl9sb2NrX3Nsb3dwYXRoKHN0cnVjdCBxc3BpbmxvY2sgKmxvY2ssIHUzMiB2YWwpOwog c3RhdGljIF9fYWx3YXlzX2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jdCBxc3BpbmxvY2sgKikmcGEubi0+bGlzdF9sb2NrKTsKKyNlbHNlCisJbmV3X3Nw aW5fbG9jaygoc3RydWN0IG5zcGlubG9jayAqKSZwYS5uLT5saXN0X2xvY2ssIGZsdXNoYXJyYXlf Zm4sICZwYSk7CisjZW5kaWYKKwlIUF9USU1JTkdfTk9XKGVuZCk7IAorCWF0b21pY19hZGRxKCZf dG90YWxfLCBlbmQgLSBzdGFydCk7CisJc2xhYnNfZGVzdHJveShwYS5jYWNoZXAsICZwYS5saXN0 KTsKKwlwYS5hYy0+YXZhaWwgLT0gcGEuYmF0Y2hjb3VudDsKKwltZW1tb3ZlKHBhLmFjLT5lbnRy eSwgJihwYS5hYy0+ZW50cnlbcGEuYmF0Y2hjb3VudF0pLCBzaXplb2Yodm9pZCAqKSpwYS5hYy0+ YXZhaWwpOwogfQogCiAvKgotLSAKMS43LjEKCg== --001a114b30741b3f360525320996 Content-Type: text/x-csrc; charset=GB2312; name="thread.c" Content-Disposition: attachment; filename="thread.c" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ihbrd89i1 LyoqDQoJVGVzdCBDYXNlOg0KCQlPcGVuRGlyLCBHZXQgc3RhdHVzIGFuZCBjbG9zZSBpdC4NCiov DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8ZGlyZW50Lmg+DQojaW5jbHVkZSA8c3lz L3N0YXQuaD4NCiNpbmNsdWRlIDxzeXMvZmNudGwuaD4NCiNpbmNsdWRlIDxzdGRpby5oPg0KI2lu Y2x1ZGUgPHN0cmluZy5oPg0KI2luY2x1ZGUgPGVycm5vLmg+DQojaW5jbHVkZSA8cHRocmVhZC5o Pg0KDQojZGVmaW5lIFRFU1RfRElSICIvdG1wL3RocmVhZCINCiNkZWZpbmUgTUFYX1RFU1RfVEhS RUFEICg4MCkNCiNkZWZpbmUgTUFYX1RFU1RfRklMRSA1MDAwDQoNCnN0YXRpYyB1bnNpZ25lZCBs b25nICpyZXN1bHRbTUFYX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DQoJCXByaW50ZigiU3RhdGlzdGljczpcbiIpOw0KDQoJCWZvciAoaSA9IDA7 IGkgPCBNQVhfVEVTVF9USFJFQUQ7IGkrKykNCgkJew0KCQkJcHJpbnRmKCIlZFx0IiwgKnJlc3Vs dFtpXSk7DQoJCX0NCgkJcHJpbnRmKCJcbiIpOw0KCQlmb3IgKGkgPSAwOyBpIDwgTUFYX1RFU1Rf VEhSRUFEOyBpKyspDQoJCQkqcmVzdWx0W2ldID0gMDsNCgl9DQp9DQo= --001a114b30741b3f360525320996-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/