@@ -939,7 +939,8 @@ unsigned int nd_region_acquire_lane(struct nd_region *nd_region)
939939{
940940 unsigned int cpu , lane ;
941941
942- cpu = get_cpu ();
942+ migrate_disable ();
943+ cpu = smp_processor_id ();
943944 if (nd_region -> num_lanes < nr_cpu_ids ) {
944945 struct nd_percpu_lane * ndl_lock , * ndl_count ;
945946
@@ -958,16 +959,15 @@ EXPORT_SYMBOL(nd_region_acquire_lane);
958959void nd_region_release_lane (struct nd_region * nd_region , unsigned int lane )
959960{
960961 if (nd_region -> num_lanes < nr_cpu_ids ) {
961- unsigned int cpu = get_cpu ();
962+ unsigned int cpu = smp_processor_id ();
962963 struct nd_percpu_lane * ndl_lock , * ndl_count ;
963964
964965 ndl_count = per_cpu_ptr (nd_region -> lane , cpu );
965966 ndl_lock = per_cpu_ptr (nd_region -> lane , lane );
966967 if (-- ndl_count -> count == 0 )
967968 spin_unlock (& ndl_lock -> lock );
968- put_cpu ();
969969 }
970- put_cpu ();
970+ migrate_enable ();
971971}
972972EXPORT_SYMBOL (nd_region_release_lane );
973973
@@ -1028,6 +1028,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
10281028
10291029 if (!nd_region )
10301030 return NULL ;
1031+ nd_region -> ndr_mappings = ndr_desc -> num_mappings ;
10311032 /* CXL pre-assigns memregion ids before creating nvdimm regions */
10321033 if (test_bit (ND_REGION_CXL , & ndr_desc -> flags )) {
10331034 nd_region -> id = ndr_desc -> memregion ;
@@ -1062,7 +1063,6 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus,
10621063
10631064 get_device (& nvdimm -> dev );
10641065 }
1065- nd_region -> ndr_mappings = ndr_desc -> num_mappings ;
10661066 nd_region -> provider_data = ndr_desc -> provider_data ;
10671067 nd_region -> nd_set = ndr_desc -> nd_set ;
10681068 nd_region -> num_lanes = ndr_desc -> num_lanes ;
0 commit comments