Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933181Ab0D3RW2 (ORCPT ); Fri, 30 Apr 2010 13:22:28 -0400 Received: from mga03.intel.com ([143.182.124.21]:22676 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933107Ab0D3RVg (ORCPT ); Fri, 30 Apr 2010 13:21:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.52,297,1270450800"; d="scan'208";a="271665105" Subject: Re: [PATCH RFC: linux-next 1/2] irq: Add CPU mask affinity hint callback framework From: Peter P Waskiewicz Jr To: Thomas Gleixner Cc: "davem@davemloft.net" , "arjan@linux.jf.intel.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" In-Reply-To: References: <20100419045741.30276.23233.stgit@ppwaskie-hc2.jf.intel.com> <1272563946.9614.1.camel@localhost> Content-Type: text/plain; charset="UTF-8" Date: Thu, 29 Apr 2010 13:28:50 -0700 Message-ID: <1272572930.9614.3.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1767 Lines: 52 On Thu, 2010-04-29 at 12:48 -0700, Thomas Gleixner wrote: > B1;2005;0cPeter, > > On Thu, 29 Apr 2010, Peter P Waskiewicz Jr wrote: > > On Wed, 2010-04-28 at 09:45 -0700, Thomas Gleixner wrote: > > > So you need a reference to your device, so what about the following: > > > > > > struct irq_affinity_hint; > > > > > > struct irq_affinity_hint { > > > unsigned int (*callback)(unsigned int irq, struct irq_affinity_hint *hint, > > > cpumask_var_t *mask); > > > } > > > > > > Now you embed that struct into your device private data structure and > > > you get the reference to it back in the callback function. No extra > > > kmalloc/kfree, less code. > > > > Good idea! I'll roll that into my new version. > > Thinking more about it, I wonder whether you have a cpu_mask in your > driver/device private data anyway. I bet you have :) Well, at this point we don't, but nothing says we can't. > So it should be sufficient to set a pointer to that cpu_mask in > irq_desc and get rid of the callback completely. So "register" would just assign the pointer, and "unregister" would make sure to NULL the mask pointer out. I like it. It'll sure clean things up too. > Any access to desc->affinity_hint needs to be protected by desc->lock. > For setting the pointer to a real mask resp. NULL that's fine. The > copy which you need to do in the proc-read function is not going to > introduce huge latencies either. Right. > Thanks, > > tglx Thanks for the additional inputs. Patches coming soon. -PJ -- 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/