All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Borislav Petkov <petkovbb@googlemail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
	Borislav Petkov <petkovbb@gmail.com>
Subject: Re: [PATCH 4/5] ide-tape: improve buffer pages freeing strategy
Date: Thu, 3 Apr 2008 23:33:23 +0200	[thread overview]
Message-ID: <200804032333.23513.bzolnier@gmail.com> (raw)
In-Reply-To: <1206812769-10065-5-git-send-email-petkovbb@gmail.com>

On Saturday 29 March 2008, Borislav Petkov wrote:
> Instead of freeing pages one by one, free them 2^order-wise. Also, mv
> __idetape_kfree_stage() to ide_tape_kfree_buffer().
> 
> Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
> ---
>  drivers/ide/ide-tape.c |   37 +++++++++++++++++++------------------
>  1 files changed, 19 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
> index cf4351c..dcaefef 100644
> --- a/drivers/ide/ide-tape.c
> +++ b/drivers/ide/ide-tape.c
> @@ -583,20 +583,21 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
>  	}
>  }
>  
> -/* Free a stage along with its related buffers completely. */
> -static void __idetape_kfree_stage(idetape_stage_t *stage)
> +/* Free data buffers completely. */
> +static void ide_tape_kfree_buffer(idetape_stage_t *stage)
>  {
>  	struct idetape_bh *prev_bh, *bh = stage->bh;
> -	int size;
> -
> -	while (bh != NULL) {
> -		if (bh->b_data != NULL) {
> -			size = (int) bh->b_size;
> -			while (size > 0) {
> -				free_page((unsigned long) bh->b_data);
> -				size -= PAGE_SIZE;
> -				bh->b_data += PAGE_SIZE;
> -			}
> +
> +	while (bh) {
> +		u32 size = bh->b_size;
> +
> +		while (size) {
> +			unsigned int order = fls(size >> PAGE_SHIFT)-1;
> +
> +			if (bh->b_data)
> +				free_pages((unsigned long)bh->b_data, order);
> +
> +			size &= (order-1);
>  		}

Hmmm, don't we also need to update bh->b_data?

[ I added the change below to the merged patch version for now: ]

@@ -598,6 +598,7 @@
 				free_pages((unsigned long)bh->b_data, order);
 
 			size &= (order-1);
+			bh->b_data += (1 << order) * PAGE_SIZE;
 		}
 		prev_bh = bh;
 		bh = bh->b_reqnext;

  reply	other threads:[~2008-04-03 21:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-29 17:46 [PATCH 0/5] ide-tape: refit tape data buffer bits/kill pipelining Borislav Petkov
2008-03-29 17:46 ` Borislav Petkov
2008-03-29 17:46 ` [PATCH 1/5] ide-tape: improve buffer allocation strategy Borislav Petkov
2008-03-29 17:46   ` Borislav Petkov
2008-04-03 21:32   ` Bartlomiej Zolnierkiewicz
2008-03-29 17:46 ` [PATCH 2/5] ide-tape: mv tape->stage_size tape->buffer_size Borislav Petkov
2008-03-29 17:46   ` Borislav Petkov
2008-03-29 17:46 ` [PATCH 3/5] ide-tape: mv tape->pages_per_stage tape->pages_per_buffer Borislav Petkov
2008-03-29 17:46   ` Borislav Petkov
2008-03-29 17:46 ` [PATCH 4/5] ide-tape: improve buffer pages freeing strategy Borislav Petkov
2008-03-29 17:46   ` Borislav Petkov
2008-04-03 21:33   ` Bartlomiej Zolnierkiewicz [this message]
2008-03-29 17:46 ` [PATCH 5/5] ide-tape: remove the last remains of pipelining Borislav Petkov
2008-03-29 17:46   ` Borislav Petkov
2008-04-03 22:04   ` Bartlomiej Zolnierkiewicz

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=200804032333.23513.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    --cc=petkovbb@googlemail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.