From mboxrd@z Thu Jan 1 00:00:00 1970 From: NeilBrown Date: Mon, 25 Jun 2018 10:57:33 +1000 Subject: [lustre-devel] [PATCH v3 13/26] staging: lustre: libcfs: use int type for CPT identification. In-Reply-To: <1529875250-11531-14-git-send-email-jsimmons@infradead.org> References: <1529875250-11531-1-git-send-email-jsimmons@infradead.org> <1529875250-11531-14-git-send-email-jsimmons@infradead.org> Message-ID: <871scvadj6.fsf@notabene.neil.brown.name> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: lustre-devel@lists.lustre.org On Sun, Jun 24 2018, James Simmons wrote: > From: Dmitry Eremin > > Use int type for CPT identification to match the linux kernel > CPU identification. Can someone site evidence for "int" being the dominant choice for CPU identification in the kernel? I looked in cpumask.h and found plenty of "unsigned int". I also found Commit: 9b130ad5bb82 ("treewide: make "nr_cpu_ids" unsigned") which makes nr_cpu_ids unsigned. So I'm dropping this patch for now as the justification is not convincing. If there is a real case to be made, please resubmit. Thanks, NeilBrown > > Signed-off-by: Dmitry Eremin > WC-bug-id: https://jira.whamcloud.com/browse/LU-8703 > Reviewed-on: https://review.whamcloud.com/23304 > Reviewed-by: James Simmons > Reviewed-by: Doug Oucharek > Reviewed-by: Oleg Drokin > Signed-off-by: James Simmons > --- > drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h | 8 ++++---- > drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c | 14 +++++++------- > 2 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h > index 9dbb0b1..2bb2140 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h > @@ -89,18 +89,18 @@ struct cfs_cpu_partition { > /* NUMA distance between CPTs */ > unsigned int *cpt_distance; > /* spread rotor for NUMA allocator */ > - unsigned int cpt_spread_rotor; > + int cpt_spread_rotor; > }; > > > /** descriptor for CPU partitions */ > struct cfs_cpt_table { > /* spread rotor for NUMA allocator */ > - unsigned int ctb_spread_rotor; > + int ctb_spread_rotor; > /* maximum NUMA distance between all nodes in table */ > unsigned int ctb_distance; > /* # of CPU partitions */ > - unsigned int ctb_nparts; > + int ctb_nparts; > /* partitions tables */ > struct cfs_cpu_partition *ctb_parts; > /* shadow HW CPU to CPU partition ID */ > @@ -355,7 +355,7 @@ static inline void cfs_cpu_fini(void) > /** > * create a cfs_cpt_table with \a ncpt number of partitions > */ > -struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt); > +struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt); > > /* > * allocate per-cpu-partition data, returned value is an array of pointers, > diff --git a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c > index aaab7cb..8f7de59 100644 > --- a/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c > +++ b/drivers/staging/lustre/lnet/libcfs/libcfs_cpu.c > @@ -73,7 +73,7 @@ > module_param(cpu_pattern, charp, 0444); > MODULE_PARM_DESC(cpu_pattern, "CPU partitions pattern"); > > -struct cfs_cpt_table *cfs_cpt_table_alloc(unsigned int ncpt) > +struct cfs_cpt_table *cfs_cpt_table_alloc(int ncpt) > { > struct cfs_cpt_table *cptab; > int i; > @@ -788,13 +788,13 @@ static int cfs_cpt_choose_ncpus(struct cfs_cpt_table *cptab, int cpt, > return rc; > } > > -#define CPT_WEIGHT_MIN 4u > +#define CPT_WEIGHT_MIN 4 > > -static unsigned int cfs_cpt_num_estimate(void) > +static int cfs_cpt_num_estimate(void) > { > - unsigned int nnode = num_online_nodes(); > - unsigned int ncpu = num_online_cpus(); > - unsigned int ncpt; > + int nnode = num_online_nodes(); > + int ncpu = num_online_cpus(); > + int ncpt; > > if (ncpu <= CPT_WEIGHT_MIN) { > ncpt = 1; > @@ -824,7 +824,7 @@ static unsigned int cfs_cpt_num_estimate(void) > /* config many CPU partitions on 32-bit system could consume > * too much memory > */ > - ncpt = min(2U, ncpt); > + ncpt = min(2, ncpt); > #endif > while (ncpu % ncpt) > ncpt--; /* worst case is 1 */ > -- > 1.8.3.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: