Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965083AbWJXEPe (ORCPT ); Tue, 24 Oct 2006 00:15:34 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965087AbWJXEPe (ORCPT ); Tue, 24 Oct 2006 00:15:34 -0400 Received: from nf-out-0910.google.com ([64.233.182.186]:5164 "EHLO nf-out-0910.google.com") by vger.kernel.org with ESMTP id S965083AbWJXEPe (ORCPT ); Tue, 24 Oct 2006 00:15:34 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:mime-version:content-type; b=f1ZmDJaeD/hwqQcamksU/7bff55lMjef+vsR40jbPIZrE7nvBsYENLl0mXGCVZD3nxyXvmMGoB3VyaxhDjbrtlmHjEqDpd7zvTUiEpAMe+kuIMDE4CQ879BgVYfgIqhKNIoeR3ZeIRDsn0p6ic3x2Wzh8VylMuYkgylVKlbGQSg= Message-ID: <86802c440610232115r76d98803o4293cdafce1fd95c@mail.gmail.com> Date: Mon, 23 Oct 2006 21:15:31 -0700 From: yhlu To: "Andi Kleen" , "Eric W. Biederman" , "Andrew Morton" Subject: [PATCH] x86_64 irq: reuse vector for __assign_irq_vector Cc: "Muli Ben-Yehuda" , "Linux Kernel Mailing List" , "Adrian Bunk" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2177_31879920.1161663331902" Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4827 Lines: 81 ------=_Part_2177_31879920.1161663331902 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline in phys flat mode, when using set_xxx_irq_affinity to irq balance from one cpu to another, _assign_irq_vector will get to increase last used vector and get new vector. this will use up the vector if enough set_xxx_irq_affintiy are called. and end with using same vector in different cpu for different irq. (that is not what we want, we only want to use same vector in different cpu for different irq when more than 0x240 irq needed). To keep it simple, the vector should be reused instead of getting new vector. Also according to Eric's review, make it more generic to be used with flat mode too. This patch need to be applied over Eric's irq: cpu_online_map patch. Cc: Eric W. Biederman Cc: Muli Ben-Yehuda Signed-off-by: Yinghai Lu ------=_Part_2177_31879920.1161663331902 Content-Type: text/x-patch; name=io_apic_reuse_vector.diff; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_etnrzxno Content-Disposition: attachment; filename="io_apic_reuse_vector.diff" LS0tIGxpbnV4LTIuNi9hcmNoL3g4Nl82NC9rZXJuZWwvaW9fYXBpYy5jCTIwMDYtMTAtMjMgMTg6 NDQ6MDUuMDAwMDAwMDAwIC0wNzAwCisrKyBsaW51eC0yLjYueHgvYXJjaC94ODZfNjQva2VybmVs L2lvX2FwaWMuYwkyMDA2LTEwLTIzIDE4OjEwOjA4LjAwMDAwMDAwMCAtMDcwMApAQCAtNjEzLDgg KzYxMyw5IEBACiAJICogMHg4MCwgYmVjYXVzZSBpbnQgMHg4MCBpcyBobSwga2luZCBvZiBpbXBv cnRhbnRpc2guIDspCiAJICovCiAJc3RhdGljIGludCBjdXJyZW50X3ZlY3RvciA9IEZJUlNUX0RF VklDRV9WRUNUT1IsIGN1cnJlbnRfb2Zmc2V0ID0gMDsKLQlpbnQgb2xkX3ZlY3RvciA9IC0xOwot CWludCBjcHU7CisJaW50IHZlY3RvciA9IC0xLCBvbGRfdmVjdG9yID0gLTE7CisJY3B1bWFza190 IGRvbWFpbiwgbmV3X21hc2s7CisJaW50IGNwdSwgbmV3X2NwdTsKIAogCUJVR19PTigodW5zaWdu ZWQpaXJxID49IE5SX0lSUV9WRUNUT1JTKTsKIApAQCAtNjI0LDE1ICs2MjUsMzAgQEAKIAlpZiAo aXJxX3ZlY3RvcltpcnFdID4gMCkKIAkJb2xkX3ZlY3RvciA9IGlycV92ZWN0b3JbaXJxXTsKIAlp ZiAob2xkX3ZlY3RvciA+IDApIHsKLQkJY3B1c19hbmQoKnJlc3VsdCwgaXJxX2RvbWFpbltpc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ZWN0b3JdID0gaXJxOworCWlycV92ZWN0b3JbaXJx XSA9IHZlY3RvcjsKKwlpcnFfZG9tYWluW2lycV0gPSBkb21haW47CisJY3B1c19hbmQoKnJlc3Vs dCwgZG9tYWluLCBtYXNrKTsKKwlyZXR1cm4gdmVjdG9yOworCiB9CiAKIHN0YXRpYyBpbnQgYXNz aWduX2lycV92ZWN0b3IoaW50IGlycSwgY3B1bWFza190IG1hc2ssIGNwdW1hc2tfdCAqcmVzdWx0 KQo= ------=_Part_2177_31879920.1161663331902-- - 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/