Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752132AbWJZJFP (ORCPT ); Thu, 26 Oct 2006 05:05:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752125AbWJZJFO (ORCPT ); Thu, 26 Oct 2006 05:05:14 -0400 Received: from nf-out-0910.google.com ([64.233.182.185]:42414 "EHLO nf-out-0910.google.com") by vger.kernel.org with ESMTP id S1752124AbWJZJE7 (ORCPT ); Thu, 26 Oct 2006 05:04:59 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=bgPmcFDso3yB+8JSCs8lvD94MeVKF/Fm8rGDdKlh1OX9opSbqEvdzMZJGrLnn2O49GsfFJMwE5eehQsIanOtIsp3+S+a9Cv7g/x4M8n+X48lDIvvoUiSd7ufdDVuSPtyairzBdsRVvq7RTgaa6OOwWdMOWXebWWjtfm3qpg3wi0= Message-ID: <86802c440610260204t4620d25t2d2e40895203b17@mail.gmail.com> Date: Thu, 26 Oct 2006 02:04:57 -0700 From: "Yinghai Lu" To: "Andi Kleen" Subject: Re: [PATCH] x86_64 irq: reuse vector for __assign_irq_vector Cc: "Eric W. Biederman" , "Andrew Morton" , "Muli Ben-Yehuda" , "Linux Kernel Mailing List" , "Adrian Bunk" In-Reply-To: <20061024170503.GA71966@muc.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_40117_24358168.1161853497644" References: <86802c440610232115r76d98803o4293cdafce1fd95c@mail.gmail.com> <20061024170503.GA71966@muc.de> X-Google-Sender-Auth: 075983ea2b371f06 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5295 Lines: 88 ------=_Part_40117_24358168.1161853497644 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Andi, please check the revised patch: It can be appied to current linus't tree. 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. It also check if new domain and old domain is equal, to avoid extra operation. Cc: Eric W. Biederman Cc: Muli Ben-Yehuda Signed-off-by: Yinghai Lu ------=_Part_40117_24358168.1161853497644 Content-Type: text/x-patch; name=io_apic_reuse_vector_1026.diff; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_etqxhek7 Content-Disposition: attachment; filename="io_apic_reuse_vector_1026.diff" ZGlmZiAtLWdpdCBhL2FyY2gveDg2XzY0L2tlcm5lbC9pb19hcGljLmMgYi9hcmNoL3g4Nl82NC9r ZXJuZWwvaW9fYXBpYy5jCmluZGV4IGZlNDI5ZTUuLjUxNTM1ZTggMTAwNjQ0Ci0tLSBhL2FyY2gv eDg2XzY0L2tlcm5lbC9pb19hcGljLmMKKysrIGIvYXJjaC94ODZfNjQva2VybmVsL2lvX2FwaWMu YwpAQCAtNjEzLDggKzYxMyw5IEBAIHN0YXRpYyBpbnQgX19hc3NpZ25faXJxX3ZlY3RvcihpbnQg aXJxLCAKIAkgKiAweDgwLCBiZWNhdXNlIGludCAweDgwIGlzIGhtLCBraW5kIG9mIGltcG9ydGFu dGlzaC4gOykKIAkgKi8KIAlzdGF0aWMgaW50IGN1cnJlbnRfdmVjdG9yID0gRklSU1RfREVWSUNF X1ZFQ1RPUiwgY3VycmVudF9vZmZzZXQgPSAwOwotCWludCBvbGRfdmVjdG9yID0gLTE7Ci0JaW50 IGNwdTsKKwlpbnQgdmVjdG9yID0gLTEsIG9sZF92ZWN0b3IgPSAtMTsKKwljcHVtYXNrX3QgZG9t YWluLCBuZXdfbWFzazsKKwlpbnQgY3B1LCBuZXdfY3B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pcnFfZG9tYWluW2lycV0g PSBkb21haW47Ci0JCWNwdXNfYW5kKCpyZXN1bHQsIGRvbWFpbiwgbWFzayk7Ci0JCXJldHVybiB2 ZWN0b3I7CisJCQorCQlnb3RvIGZvdW5kX29uZTsKIAl9CisKIAlyZXR1cm4gLUVOT1NQQzsKKwor Zm91bmRfb25lOgorCWlmIChvbGRfdmVjdG9yID49IDApIHsKKwkJY3B1bWFza190IG9sZF9tYXNr OworCQlpbnQgb2xkX2NwdTsKKwkJY3B1c19hbmQob2xkX21hc2ssIGlycV9kb21haW5baXJxXSwg Y3B1X29ubGluZV9tYXApOworCQlmb3JfZWFjaF9jcHVfbWFzayhvbGRfY3B1LCBvbGRfbWFzaykK KwkJCXBlcl9jcHUodmVjdG9yX2lycSwgb2xkX2NwdSlbb2xkX3ZlY3Rvcl0gPSAtMTsKKwl9CisJ Zm9yX2VhY2hfY3B1X21hc2sobmV3X2NwdSwgbmV3X21hc2spCisJCXBlcl9jcHUodmVjdG9yX2ly cSwgbmV3X2NwdSlbdmVjdG9yXSA9IGlycTsKKwlpcnFfdmVjdG9yW2lycV0gPSB2ZWN0b3I7CisJ aXJxX2RvbWFpbltpcnFdID0gZG9tYWluOworCWNwdXNfYW5kKCpyZXN1bHQsIGRvbWFpbiwgbWFz ayk7CisJcmV0dXJuIHZlY3RvcjsKKwogfQogCiBzdGF0aWMgaW50IGFzc2lnbl9pcnFfdmVjdG9y KGludCBpcnEsIGNwdW1hc2tfdCBtYXNrLCBjcHVtYXNrX3QgKnJlc3VsdCkK ------=_Part_40117_24358168.1161853497644-- - 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/