Date: Tue, 24 Oct 2006 13:31:37 +0400 From: "Stepan A. Baranov" <rosmir@gmail.com> To: davidxu@freebsd.org, freebsd-hackers@freebsd.org Subject: scheduler CORE for RELENG_6 Message-ID: <9c6e52b10610240231h72fdb7a9xec1078e0937ed24b@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
------=_Part_3894_21344688.1161682297840 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, I prepared patch to port scheduler from HEAD to RELENG_6. I applied this patch for my workstation and scheduler CORE works fine. After applying patch you can say: options SCHED_CORE # CORE scheduler in your KERN CONF file and rebuild your kernel. Please, test it and fix it. Stepan Baranov. ------=_Part_3894_21344688.1161682297840 Content-Type: application/octet-stream; name=patch-add-CORE Content-Transfer-Encoding: base64 X-Attachment-Id: f_etnv1i65 Content-Disposition: attachment; filename="patch-add-CORE" SW5kZXg6IC4vc3lzL3N5cy9zY2hlZC5oCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9ob21lL25jdnMv c3JjL3N5cy9zeXMvc2NoZWQuaCx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4yNApkaWZmIC11IC1y MS4yNCBzY2hlZC5oCi0tLSAuL3N5cy9zeXMvc2NoZWQuaAkxOSBBcHIgMjAwNSAwNDowMToyNSAt MDAwMAkxLjI0CisrKyAuL3N5cy9zeXMvc2NoZWQuaAkyNCBPY3QgMjAwNiAwOToxMDowNyAtMDAw MApAQCAtNzgsNiArNzgsOCBAQAogdm9pZAlzY2hlZF9hZGQoc3RydWN0IHRocmVhZCAqdGQsIGlu dCBmbGFncyk7CiB2b2lkCXNjaGVkX2Nsb2NrKHN0cnVjdCB0aHJlYWQgKnRkKTsKIHZvaWQJc2No ZWRfcmVtKHN0cnVjdCB0aHJlYWQgKnRkKTsKK3ZvaWQJc2NoZWRfdGljayh2b2lkKTsKK3Zv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QlydW50aW1lID0gTlNfTUFYX1NMRUVQX1RJTUU7CisJCX0KKwkJcnVudGltZSAvPSAoQ1VS UkVOVF9TQ09SRShrZykgPyA6IDEpOworCQlrZy0+a2dfcnVudGltZSArPSBydW50aW1lOworCQlr ZS0+a2VfdGltZXN0YW1wID0gbm93OworCX0KK30KKworc3RhdGljIHZvaWQKK3NjaGVkX2NvbW1p dF9ydW50aW1lKHN0cnVjdCBrc2UgKmtlKQoreworCXN0cnVjdCBrc2VncnAgKmtnID0ga2UtPmtl X2tzZWdycDsKKworCWlmIChrZy0+a2dfcnVudGltZSA+IGtnLT5rZ19zbHB0aW1lKQorCQlrZy0+ a2dfc2xwdGltZSA9IDA7CisJZWxzZQorCQlrZy0+a2dfc2xwdGltZSAtPSBrZy0+a2dfcnVudGlt ZTsKKwlrZy0+a2dfcnVudGltZSA9IDA7Cit9CisKK3N0YXRpYyB2b2lkCitrc2VxX3NldHVwKHN0 cnVjdCBrc2VxICprc2VxKQoreworCWtydW5xX2luaXQoJmtzZXEtPmtzcV90aW1lc2hhcmVbMF0p OworCWtydW5xX2luaXQoJmtzZXEtPmtzcV90aW1lc2hhcmVbMV0pOworCWtydW5xX2luaXQoJmtz ZXEtPmtzcV9pZGxlKTsKKwlrc2VxLT5rc3FfY3VyciA9ICZrc2VxLT5rc3FfdGltZXNoYXJlWzBd OworCWtzZXEtPmtzcV9uZXh0ID0gJmtzZXEtPmtzcV90aW1lc2hhcmVbMV07CisJa3NlcS0+a3Nx X2V4cGlyZWRfbmljZSA9IFBSSU9fTUFYICsgMTsKKwlrc2VxLT5rc3FfZXhwaXJlZF90aWNrID0g MDsKK30KKworc3RhdGljIHZvaWQKK3NjaGVkX3NldHVwKHZvaWQgKmR1bW15KQoreworI2lmZGVm IFNNUAorCWludCBpOworI2VuZGlmCisKKwkvKgorCSAqIFRvIGF2b2lkIGRpdmlkZS1ieS16ZXJv LCB3ZSBzZXQgcmVhbHN0YXRoeiBhIGR1bW15IHZhbHVlCisJICogaW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2l4NC9rc2NoZWQuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvaG9tZS9uY3ZzL3Ny Yy9zeXMvcG9zaXg0L2tzY2hlZC5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjI2CmRpZmYgLXUg LXIxLjI2IGtzY2hlZC5jCi0tLSAuL3N5cy9wb3NpeDQva3NjaGVkLmMJNyBKYW4gMjAwNSAwMjoy OToxOSAtMDAwMAkxLjI2CisrKyAuL3N5cy9wb3NpeDQva3NjaGVkLmMJMjQgT2N0IDIwMDYgMDk6 MTM6NTkgLTAwMDAKQEAgLTI0Niw5ICsyNDYsNyBAQAogICovCiBpbnQga3NjaGVkX3lpZWxkKHJl Z2lzdGVyX3QgKnJldCwgc3RydWN0IGtzY2hlZCAqa3NjaGVkKQogewotCW10eF9sb2NrX3NwaW4o JnNjaGVkX2xvY2spOwotCWN1cnRocmVhZC0+dGRfZmxhZ3MgfD0gVERGX05FRURSRVNDSEVEOwot CW10eF91bmxvY2tfc3Bpbigmc2NoZWRfbG9jayk7CisJc2NoZWRfcmVsaW5xdWlzaChjdXJ0aHJl YWQpOwogCXJldHVybiAwOwogfQogCg== ------=_Part_3894_21344688.1161682297840--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9c6e52b10610240231h72fdb7a9xec1078e0937ed24b>