Messages in this thread | | | Date | Wed, 9 Nov 2011 18:43:58 -0800 (PST) | From | David Rientjes <> | Subject | Re: [patch 1/5]thp: improve the error code path |
| |
On Thu, 10 Nov 2011, Shaohua Li wrote:
> > hugepage_attr_group is defined even if CONFIG_SYSFS is not set and I > > just made a build with CONFIG_SYSFS=n and it builds just fine without > > any change. > > > $ grep CONFIG_SYSFS .config > > # CONFIG_SYSFS is not set > > > > So we can drop 1/5 above. > this isn't the case in the code. And the code uses hugepage_attr_group > is already within CONFIG_SYSFS, so your build success. >
You're right, but I agree that the #ifdef's just make the function error handling much too complex. Would you mind adding sysfs_*_out labels at the end of the function to handle these errors instead? And I think we should be doing khugepaged_slab_init() and mm_slots_hash_init() before initializing sysfs.
Something like
out: khugepaged_slab_free(); mm_slots_hash_free(); <-- after you remove it from #if 0 return err;
#ifdef CONFIG_SYSFS sysfs_khugepaged_out: sysfs_remove_group(hugepage_kobj, &khugepaged_attr_group); sysfs_hugepage_out: sysfs_remove_group(hugepage_kobj, &hugepage_attr_group); ... goto out; #endif
| |