public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@zip.com.au>
To: "Adam J. Richter" <adam@yggdrasil.com>
Cc: axboe@suse.de, colpatch@us.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: Patch??: linux-2.5.20/fs/bio.c - ll_rw_kio could generate bio's  bigger than queue could handle
Date: Thu, 06 Jun 2002 12:34:06 -0700	[thread overview]
Message-ID: <3CFFB92E.E4549B33@zip.com.au> (raw)
In-Reply-To: <200206061331.GAA00287@baldur.yggdrasil.com>

"Adam J. Richter" wrote:
> 
> ...
> +int bio_append(struct bio **bio_p, struct page *page, int len, int offset)
> +{
> +       struct bio *bio = *bio_p;
> +       struct bio_vec *vec;
> +       if (bio->bi_idx == bio->bi_vcnt) {
> +               struct bio *old = bio;
> +               *bio_p = bio = bio_alloc(GFP_KERNEL, old->bi_vcnt);

GFP_KERKEL is OK on the readpages() path, but on the writepages()
path it can go infinitely recursive - it needs to be GFP_NOFS.
So another arg is needed here.  I suspect this function ends up adding
more complexity than it takes away, frankly.

> +               if (bio != NULL) {
> +                       bio->bi_sector =
> +                               old->bi_sector + (old->bi_size >> 9);
> +
> +#define COPY(field)    bio->bi_ ## field = old->bi_ ## field
> +                       COPY(bdev);
> +                       COPY(flags);
> +                       COPY(idx);
> +                       COPY(rw);
> +                       COPY(end_io);
> +                       COPY(private);
> +#undef COPY
> +               }
> +               old->bi_idx = 0;
> +               submit_bio(old->bi_rw, old);

Here we're allocating a new BIO before submitting the old one.
This increases the risk of oom deadlocks on the vm_writeback()
path.

I'd prefer that the bio alloc/submit code paths be left as-is...


> +       struct block_device *bdev =
> +               S_ISBLK(inode->i_mode) ? inode->i_bdev : inode->i_sb->s_bdev;

I believe it's cleaner to allow get_block() to decide which
blockdevice belongs to this mapping, really.

-

  reply	other threads:[~2002-06-06 19:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-06 13:31 Patch??: linux-2.5.20/fs/bio.c - ll_rw_kio could generate bio's bigger than queue could handle Adam J. Richter
2002-06-06 19:34 ` Andrew Morton [this message]
2002-06-06 22:06 ` Matthew Dobson
  -- strict thread matches above, loose matches on Subject: below --
2002-06-07 22:46 Adam J. Richter
2002-06-07 22:12 Adam J. Richter
2002-06-07 12:46 Adam J. Richter
2002-06-07 16:52 ` Thunder from the hill
2002-06-07 20:19 ` Andrew Morton
2002-06-06 23:26 Adam J. Richter
2002-06-07  2:14 ` Andrew Morton
2002-06-06  8:49 Adam J. Richter
2002-06-06  9:18 ` Andrew Morton
2002-06-06  1:22 Adam J. Richter
2002-06-06  1:48 ` Andrew Morton
2002-06-05 10:44 Adam J. Richter

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=3CFFB92E.E4549B33@zip.com.au \
    --to=akpm@zip.com.au \
    --cc=adam@yggdrasil.com \
    --cc=axboe@suse.de \
    --cc=colpatch@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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