Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753035Ab2EZNiU (ORCPT ); Sat, 26 May 2012 09:38:20 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:37719 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752036Ab2EZNiS (ORCPT ); Sat, 26 May 2012 09:38:18 -0400 MIME-Version: 1.0 Date: Sat, 26 May 2012 21:38:16 +0800 Message-ID: Subject: [ANNOUNCE][PATCH 5/26]Rotary Interactivity Favor Scheduler Version 3(Brain-Eating) Update. From: Chen To: linux-kernel@vger.kernel.org Cc: mou Chen , Hillf Danton , Ingo Molnar , Peter Zijlstra Content-Type: multipart/mixed; boundary=e89a8f64354af46ac804c0f09832 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 297672 Lines: 3909 --e89a8f64354af46ac804c0f09832 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: quoted-printable Hi everyone. RIFS v3 has been released. This version make a big change from RIFS v2(Algorithm). Actually it solves problems that V2 left. On my box I can play 320K MP3 music without any skipping(SMOOTH!).Also I can shake my windows frequently. 1.latt benchmark Parameters: min_wait=3D100ms, max_wait=3D500ms, clients=3D1 Entries logged: 108 Wakeup averages ------------------------------------- Max 25 usec Avg 10 usec Stdev 2 usec Stdev mean 0 usec Work averages ------------------------------------- Max 21183 usec Avg 20129 usec Stdev 246 usec Stdev mean 24 usec 2.latt benchmark Parameters: min_wait=3D100ms, max_wait=3D500ms, clients=3D1 Entries logged: 108 Wakeup averages ------------------------------------- Max 22 usec Avg 8 usec Stdev 2 usec Stdev mean 0 usec Work averages ------------------------------------- Max 20326 usec Avg 20016 usec Stdev 85 usec Stdev mean 8 usec ~~~ :-) Enjoy the interactive feels. =CF=ED=CA=DC=BD=BB=BB=A5=D0=D4=B4=F8=C0=B4=B5=C4=B8=D0=BE=F5=B0=D1 Chen --e89a8f64354af46ac804c0f09832 Content-Type: application/octet-stream; name="rifs-v3-kernel3.3.x" Content-Disposition: attachment; filename="rifs-v3-kernel3.3.x" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h2opuj8w0 ZGlmZiAtcnVOIGxpbnV4LTMuMy41L2FyY2gvcG93ZXJwYy9wbGF0Zm9ybXMvY2VsbC9zcHVmcy9z Y2hlZC5jIGxpbnV4LTMuMy41LVJJRlMtUkMzLUJSQUlOLUVBVElORy9hcmNoL3Bvd2VycGMvcGxh dGZvcm1zL2NlbGwvc3B1ZnMvc2NoZWQuYwotLS0gbGludXgtMy4zLjUvYXJjaC9wb3dlcnBjL3Bs YXRmb3Jtcy9jZWxsL3NwdWZzL3NjaGVkLmMJMjAxMi0wNS0wNyAyMzo1NTozMC4wMDAwMDAwMDAg KzA4MDAKKysrIGxpbnV4LTMuMy41LVJJRlMtUkMzLUJSQUlOLUVBVElORy9hcmNoL3Bvd2VycGMv cGxhdGZvcm1zL2NlbGwvc3B1ZnMvc2NoZWQuYwkyMDEyLTA1LTE5IDIyOjA0OjM3LjAwMDAwMDAw MCArMDgwMApAQCAtNjMsMTEgKzYzLDYgQEAKIHN0YXRpYyBzdHJ1Y3QgdGltZXJfbGlzdCBzcHVs b2FkYXZnX3RpbWVyOwogCiAvKgotICogUHJpb3JpdHkgb2YgYSBub3JtYWwsIG5vbi1ydCwgbm9u LW5pY2VkJ2QgcHJvY2VzcyAoYWthIG5pY2UgbGV2ZWwgMCkuCi0gKi8KLSNkZWZpbmUgTk9STUFM X1BSSU8JCTEyMAotCi0vKgogICogRnJlcXVlbmN5IG9mIHRoZSBzcHUgc2NoZWR1bGVyIHRpY2su ICBCeSBkZWZhdWx0IHdlIGRvIG9uZSBTUFUgc2NoZWR1bGVyCiAgKiB0aWNrIGZvciBldmVyeSAx MCBDUFUgc2NoZWR1bGVyIHRpY2tzLgogICovCmRpZmYgLXJ1TiBsaW51eC0zLjMuNS9hcmNoL3g4 Ni9LY29uZmlnIGxpbnV4LTM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2 ICszMDMsMTYgQEAKIAogPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT0KIAoraXNvX2NwdTogKEJGUyBDUFUgc2NoZWR1bGVyIG9ubHkp LgorCitUaGlzIHNldHMgdGhlIHBlcmNlbnRhZ2UgY3B1IHRoYXQgdGhlIHVucHJpdmlsZWdlZCBT Q0hFRF9JU08gdGFza3MgY2FuCitydW4gZWZmZWN0aXZlbHkgYXQgcmVhbHRpbWUgcHJpb3JpdHks IGF2ZXJhZ2VkIG92ZXIgYSByb2xsaW5nIGZpdmUKK3NlY29uZHMgb3ZlciB0aGUgLXdob2xlLSBz eXN0ZW0sIG1lYW5pbmcgYWxsIGNwdXMuCisKK1NldCB0byA3MCAocGVyY2VudCkgYnkgZGVmYXVs dC4KKworPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT0KKwogbDJjcjogKFBQQyBvbmx5KQogCiBUaGlzIGZsYWcgY29udHJvbHMgdGhl IEwyIGNhY2hlIG9mIEczIHByb2Nlc3NvciBib2FyZHMuIElmCkBAIC01MTcsNiArNTI5LDIwIEBA CiAKID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09CiAKK3JyX2ludGVydmFsOiAoQkZTIENQVSBzY2hlZHVsZXIgb25seSkKKworVGhp cyBpcyB0aGUgc21hbGxlc3QgZHVyYXRpb24gdGhhdCBhbnkgY3B1IHByb2Nlc3Mgc2NoZWR1bGlu ZyB1bml0Cit3aWxsIHJ1biBmb3IuIEluY3JlYXNpbmcgdGhpcyB2YWx1ZSBjYW4gaW5jcmVhc2Ug dGhyb3VnaHB1dCBvZiBjcHUKK2JvdW5kIHRhc2tzIHN1YnN0YW50aWFsbHkgYnV0IGF0IHRoZSBl eHBlbnNlIG9mIGluY3JlYXNlZCBsYXRlbmNpZXMKK292ZXJhbGwuIENvb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VldWVkKHApOworCisJ b2xkX3N0YXRpYyA9IHAtPnN0YXRpY19wcmlvOworCXAtPnN0YXRpY19wcmlvID0gbmV3X3N0YXRp YzsKKwlwLT5wcmlvID0gcC0+c3RhdGljX3ByaW87CisKKwlpZiAocXVldWVkKSB7CisJCWlmIChu ZXdfc3RhdGljIDwgb2xkX3N0YXRpYykKKwkJCXRyeV9wcmVlbXB0KHAsIHJxKTsKKwl9IGVsc2Ug aWYgKHRhc2tfcnVubmluZyhwKSkgeworCQlyZXNldF9ycV90YXNrKHJxLCBwKTsKKwkJaWYgKG9s ZF9zdGF0aWMgPCBuZXdfc3RhdGljKQorCQkJcmVzY2hlZF90YXNrKHApOworCX0KK291dF91bmxv Y2s6CisJdGFza19ncnFfdW5sb2NrKCZmbGFncyk7Cit9CitFWFBPUlRfU1lNQk9MKHNldF91c2Vy X25pY2UpOworCisvKgorICogY2FuX25pY2UgLSBjaGVjayBpZiBhIHRhc2sgY2FuIHJlZHVjZSBp dHMgbmljZSB2YWx1ZQorICogQHA6IHRhc2sKKyAqIEBuaWNlOiBuaWNlIHZhbHVlCisgKi8KK2lu dCBjYW5fbmljZShjb25zdCBzdHJ1Y3QgdGFza19zdHJ1Y3QgKnAsIGNvbnN0IGludCBuaWNlKQor eworCS8qIGNvbnZlcnQgbmljZSB2YWx1ZSBbMTksLTIwXSB0byBybGltaXQgc3R5bGUgdmFsdWUg WzEsNDBdICovCisJaW50IG5pY2VfcmxpbSA9IDIwIC0gbmljZTsKKworCXJldHVybiAobmljZV9y bGltIDw9IHRhc2tfcmxpbWl0KHAsIFJMSU1JVF9OSUNFKSB8fAorCQljYXBhYmxlKENBUF9TWVNf TklDRSkpOworfQorCisjaWZkZWYgX19BUkNIX1dBTlRfU1lTX05JQ0UKKworLyoKKyAqIHN5c19u aWNlIC0gY2hhbmdlIHRoZSBwcmlvcml0eSBvZiB0aGUgY3VycmVudCBwcm9jZXNzLgorICogQGlu Y3JlbWVudDogcHJpb3JpdHkgaW5jcmVtZW50CisgKgorICogc3lzX3NldHByaW9yaXR5IGlzIGEg bW9yZSBnZW5lcmljLCBidXQgbXVjaCBzbG93ZXIgZnVuY3Rpb24gdGhhdAorICogZG9lcyBzaW1p bGFyIHRoaW5ncy4KKyAqLworU1lTQ0FMTF9ERUZJTkUxKG5pY2UsIGludCwgaW5jcmVtZW50KQor eworCWxvbmcgbmljZSwgcmV0dmFsOworCisJLyoKKwkgKiBTZXRwcmlvcml0eSBtaWdodCBjaGFu Z2Ugb3VyIHByaW9yaXR5IGF0IHRoZSBzYW1lIG1vbWVudC4KKwkgKiBXZSBkb24ndCBoYXZlIHRv IHdvcnJ5LiBDb25jZXB0dWFsbHkgb25lIGNhbGwgb2NjdXJzIGZpcnN0CisJICogYW5kIHdlIGhh dmUgYSBzaW5nbGUgd2lubmVyLgorCSAqLworCWlmIChpbmNyZW1lbnQgPCAtNDApCisJCWluY3Jl bWVudCA9IC00MDsKKwlpZiAoaW5jcmVtZW50ID4gNDApCisJCWluY3JlbWVudCA9IDQwOworCisJ bmljZSA9IFRBU0tfTklDRShjdXJyZW50KSArIGluY3JlbWVudDsKKwlpZiAobmljZSA8IC0yMCkK KwkJbmljZSA9IC0yMDsKKwlpZiAobmljZSA+IDE5KQorCQluaWNlID0gMTk7CisKKwlpZiAoaW5j cmVtZW50IDwgMCAmJiAhY2FuX25pY2UoY3VycmVudCwgbmljZSkpCisJCXJldHVybiAtRVBFUk07 CisKKwlyZXR2YWwgPSBzZWN1cml0eV90YXNrX3NldG5pY2UoY3VycmVudCwgbmljZSk7CisJaWYg KHJldHZhbCkKKwkJcmV0dXJuIHJldHZhbDsKKworCXNldF91c2VyX25pY2UoY3VycmVudCwgbmlj ZSk7CisJcmV0dXJuIDA7Cit9CisKKyNlbmRpZgorCisvKioKKyAqIHRhc2tfcHJpbyAtIHJldHVy biB0aGUgcHJpb3JpdHkgdmFsdWUgb2YgYSBnaXZlbiB0YXNrLgorICogQHA6IHRoZSB0YXNrIGlu IHF1ZXN0aW9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2tfY29weShuZXdfbWFzaywgY3B1c19hbGxvd2VkKTsKKwkJCWdvdG8gYWdh aW47CisJCX0KKwl9CitvdXRfdW5sb2NrOgorCWZyZWVfY3B1bWFza192YXIobmV3X21hc2spOwor b3V0X2ZyZWVfY3B1c19hbGxvd2VkOgorCWZyZWVfY3B1bWFza192YXIoY3B1c19hbGxvd2VkKTsK K291dF9wdXRfdGFzazoKKwlwdXRfdGFza19zdHJ1Y3QocCk7CisJcHV0X29ubGluZV9jcHVzKCk7 CisJcmV0dXJuIHJldHZhbDsKK30KKworc3RhdGljIGludCBnZXRfdXNlcl9jcHVfbWFzayh1bnNp Z25lZCBsb25nIF9fdXNlciAqdXNlcl9tYXNrX3B0ciwgdW5zaWduZWQgbGVuLAorCQkJCSBjcHVt YXNrX3QgKm5ld19tYXNrKQoreworCWlmIChsZW4gPCBzaXplb2YoY3B1bWFza190KSkgeworCQlt ZW1zZXQobmV3X21hc2ssIDAsIHNpemVvZihjcHVtYXNrX3QpKTsKKwl9IGVsc2UgaWYgKGxlbiA+ IHNpemVvZihjcHVtYXNrX3QpKSB7CisJCWxlbiA9IHNpemVvZihjcHVtYXNrX3QpOworCX0KKwly ZXR1cm4gY29weV9mcm9tX3VzZXIobmV3X21hc2ssIHVzZXJfbWFza19wdHIsIGxlbikgPyAtRUZB VUxUIDogMDsKK30KKworCisvKioKKyAqIHN5c19zY2hlZF9zZXRhZmZpbml0eSAtIHNldCB0aGUg Y3B1IGFmZmluaXR5IG9mIGEgcHJvY2VzcworICogQHBpZDogcGlkIG9mIHRoZSBwcm9jZXNzCisg KiBAbGVuOiBsZW5ndGggaW4gYnl0ZXMgb2YgdGhlIGJpdG1hc2sgcG9pbnRlZCB0byBieSB1c2Vy X21hc2tfcHRyCisgKiBAdXNlcl9tYXNrX3B0cjogdXNlci1zcGFjZSBwb2ludGVyIHRvIHRoZSBu ZXcgY3B1IG1hc2sKKyAqLworU1lTQ0FMTF9ERUZJTkUzKHNjaGVkX3NldGFmZmluaXR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LDcgQEAKIHZvaWQgd2FrZXVw X2tzd2FwZChzdHJ1Y3Qgem9uZSAqem9uZSwgaW50IG9yZGVyLCBlbnVtIHpvbmVfdHlwZSBjbGFz c3pvbmVfaWR4KQogewogCXBnX2RhdGFfdCAqcGdkYXQ7CisJaW50IGFjdGl2ZTsKIAogCWlmICgh cG9wdWxhdGVkX3pvbmUoem9uZSkpCiAJCXJldHVybjsKQEAgLTMxMTcsNyArMzE0Nyw5IEBACiAJ CXBnZGF0LT5rc3dhcGRfbWF4X29yZGVyID0gb3JkZXI7CiAJCXBnZGF0LT5jbGFzc3pvbmVfaWR4 ID0gbWluKHBnZGF0LT5jbGFzc3pvbmVfaWR4LCBjbGFzc3pvbmVfaWR4KTsKIAl9Ci0JaWYgKCF3 YWl0cXVldWVfYWN0aXZlKCZwZ2RhdC0+a3N3YXBkX3dhaXQpKQorCWFjdGl2ZSA9IHdhaXRxdWV1 ZV9hY3RpdmUoJnBnZGF0LT5rc3dhcGRfd2FpdCk7CisJc2V0X2tzd2FwZF9uaWNlKHBnZGF0LT5r c3dhcGQsIGFjdGl2ZSk7CisJaWYgKCFhY3RpdmUpCiAJCXJldHVybjsKIAlpZiAoem9uZV93YXRl cm1hcmtfb2tfc2FmZSh6b25lLCBvcmRlciwgbG93X3dtYXJrX3BhZ2VzKHpvbmUpLCAwLCAwKSkK IAkJcmV0dXJuOwo= --e89a8f64354af46ac804c0f09832-- -- 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/