diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 1a9391c75..29f75016b 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7173,7 +7173,13 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, } if (atomic_read(&scst_measure_latency)) { - sess->lat_stats = vzalloc(sizeof(*sess->lat_stats)); + /* + * To do: remove higher order allocation from the code below + * for the GFP_ATOMIC case. + */ + sess->lat_stats = gfp_mask & GFP_ATOMIC ? + kzalloc(sizeof(*sess->lat_stats), gfp_mask) : + vzalloc(sizeof(*sess->lat_stats)); if (!sess->lat_stats) goto out_free_name; } @@ -7232,7 +7238,7 @@ void scst_free_session(struct scst_session *sess) mutex_unlock(&scst_mutex); kfree(sess->transport_id); - vfree(sess->lat_stats); + kvfree(sess->lat_stats); kfree(sess->initiator_name); if (sess->sess_name != sess->initiator_name) kfree(sess->sess_name); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index c0f931374..24a596aca 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -6986,7 +6986,7 @@ static void scst_free_lat_stats_mem(void) list_for_each_entry(tgt, &tt->tgt_list, tgt_list_entry) { list_for_each_entry(sess, &tgt->sess_list, sess_list_entry) { - vfree(sess->lat_stats); + kvfree(sess->lat_stats); sess->lat_stats = NULL; } }