X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Flibcfs%2Flibcfs_cpu.c;h=e18398661814a8a2074158f05d258991c4eb3030;hp=6eb9591e60825792998cf86eb772a2380df20d8b;hb=77771ff24c03a59fc96a7f41199a6b73530a418a;hpb=1224084c6300d5b15ccb703dfe18209a0f1f12ab diff --git a/libcfs/libcfs/libcfs_cpu.c b/libcfs/libcfs/libcfs_cpu.c index 6eb9591..e183986 100644 --- a/libcfs/libcfs/libcfs_cpu.c +++ b/libcfs/libcfs/libcfs_cpu.c @@ -868,7 +868,14 @@ static struct cfs_cpt_table *cfs_cpt_table_create(int ncpt) if (ncpt <= 0) ncpt = num; - if (ncpt > num_online_cpus() || ncpt > 4 * num) { + if (ncpt > num_online_cpus()) { + rc = -EINVAL; + CERROR("libcfs: CPU partition count %d > cores %d: rc = %d\n", + ncpt, num_online_cpus(), rc); + goto failed; + } + + if (ncpt > 4 * num) { CWARN("CPU partition number %d is larger than suggested value (%d), your system may have performance issue or run out of memory while under pressure\n", ncpt, num); } @@ -1230,7 +1237,7 @@ int cfs_cpu_init(void) failed_alloc_table: put_online_cpus(); - if (cfs_cpt_table) + if (!IS_ERR_OR_NULL(cfs_cpt_table)) cfs_cpt_table_free(cfs_cpt_table); #ifdef CONFIG_HOTPLUG_CPU