Skip to content

Large TRIM size and high iodepth causes cause OOM during replay #2056

@dennis-cher-chang

Description

@dennis-cher-chang

When there is combination of high iodepth and TRIM large range, the memory footprint goes sky high and then OOM.

When I replay a trace, there is a TRIM command inside with 4GB range. It can replay when iodepth=1 but it will go OOM when iodepth is larger.

read_blktrace() -> queue_trace() -> handle_trace_discard()

static bool handle_trace_discard() {
	if (t->bytes > bs[DDIR_TRIM])
                 // bs[DDIR_TRIM] = 4GB now
		bs[DDIR_TRIM] = t->bytes;
            

and then propagate to td->o.max_bs

bool read_blktrace(struct thread_data* td) {
    td->o.max_bs[DDIR_TRIM] = max(td->o.max_bs[DDIR_TRIM], rw_bs[DDIR_TRIM]);

and then it will allocate 4GB * iodepth buffers

int init_io_u_buffers(struct thread_data *td)
{
	max_units = td->o.iodepth;
	max_bs = td_max_bs(td);
        // 4GB * iodepth => 4GB * 1024
	td->orig_buffer_size = (unsigned long long) max_bs
					* (unsigned long long) max_units;

Should we modify td_max_bs() to remove DDIR_TRIM ?

static inline unsigned long long td_max_bs(struct thread_data *td)
{
	unsigned long long max_bs;

	max_bs = max(td->o.max_bs[DDIR_READ], td->o.max_bs[DDIR_WRITE]);

        // just return max_bs here
	return max(td->o.max_bs[DDIR_TRIM], max_bs);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    needreporterinfoWaiting on information from the issue reporter

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions