mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Shaohua Li <shaohua.li@intel.com>
Cc: linux-kernel@vger.kernel.org, jens.axboe@oracle.com
Subject: Re: [PATCH]cfq-iosched: fix an oops caused by slab leak
Date: Wed, 26 May 2010 15:42:57 -0400	[thread overview]
Message-ID: <x49fx1ea1q6.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20100525011849.GA29820@sli10-desk.sh.intel.com> (Shaohua Li's message of "Tue, 25 May 2010 09:18:49 +0800")

Shaohua Li <shaohua.li@intel.com> writes:

> I got below oops when unloading cfq-iosched. Considering scenario:
> queue A merge to B, C merge to D and B will be merged to D. Before B is merged
> to D, we do split B. We should put B's reference for D.
[...]
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
>
> diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
> index ed897b5..855fd5f 100644
> --- a/block/cfq-iosched.c
> +++ b/block/cfq-iosched.c
> @@ -2537,15 +2537,10 @@ static void cfq_free_io_context(struct io_context *ioc)
>  	__call_for_each_cic(ioc, cic_free_func);
>  }
>  
> -static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> +static void cfq_put_cooperator(struct cfq_queue *cfqq)
>  {
>  	struct cfq_queue *__cfqq, *next;
>  
> -	if (unlikely(cfqq == cfqd->active_queue)) {
> -		__cfq_slice_expired(cfqd, cfqq, 0);
> -		cfq_schedule_dispatch(cfqd);
> -	}
> -
>  	/*
>  	 * If this queue was scheduled to merge with another queue, be
>  	 * sure to drop the reference taken on that queue (and others in
> @@ -2561,6 +2556,16 @@ static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
>  		cfq_put_queue(__cfqq);
>  		__cfqq = next;
>  	}
> +}
> +
> +static void cfq_exit_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq)
> +{
> +	if (unlikely(cfqq == cfqd->active_queue)) {
> +		__cfq_slice_expired(cfqd, cfqq, 0);
> +		cfq_schedule_dispatch(cfqd);
> +	}
> +
> +	cfq_put_cooperator(cfqq);
>  
>  	cfq_put_queue(cfqq);
>  }
> @@ -3516,6 +3521,9 @@ split_cfqq(struct cfq_io_context *cic, struct cfq_queue *cfqq)
>  	}
>  
>  	cic_set_cfqq(cic, NULL, 1);
> +
> +	cfq_put_cooperator(cfqq);
> +
>  	cfq_put_queue(cfqq);
>  	return NULL;
>  }

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

      parent reply	other threads:[~2010-05-26 19:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-25  1:18 Shaohua Li
2010-05-25  8:15 ` Jens Axboe
2010-05-26 19:42 ` Jeff Moyer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x49fx1ea1q6.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shaohua.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®