Re: [PATCH 1/2] block: fix leaks associated with discard requestpayload

From: Boaz Harrosh
Date: Wed Jun 30 2010 - 04:32:54 EST


On 06/27/2010 06:29 PM, James Bottomley wrote:
<snip>
>> + /*
>> + * If this is a discard request that originated from the kernel
>> + * we need to free our payload here. Note that we need to check
>> + * the request flag as the normal payload rules apply for
>> + * pass-through UNMAP / WRITE SAME requests.
>> + */
>> + __free_page(bio_page(cmd->request->bio));
>
> This is another layering violation: the page is allocated in the Upper
> layer and freed in the mid-layer.
>

May I ask a silly question? Why the dynamic allocation?

Why not have a const-static single global page at the block-layer somewhere
that will be used for all discard-type operations and be done with it once and
for all. A single page can be used for any size bio , any number of concurrent
discards, any ZERO needed operation. It can also be used by other operations
like padding and others. In fact isn't there one for the libsata padding?

(It could be dynamical allocated on first use for embedded system)

just my $0.017
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/