From: NeilBrown <neilb@suse.com>
To: Anna Schumaker <Anna.Schumaker@Netapp.com>,
Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NFS: fix usage of mempools.
Date: Tue, 11 Apr 2017 07:42:26 +1000 [thread overview]
Message-ID: <87r310vt19.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <586583e7-58d4-2386-aa71-f0a63ca93002@Netapp.com>
[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]
On Mon, Apr 10 2017, Anna Schumaker wrote:
> Hi Neil,
>
> On 04/09/2017 10:22 PM, NeilBrown wrote:
>>
>> + /* It is OK to do some reclaim, not no safe to wait
>> + * for anything to be returned to the pool.
>> + * mempool_alloc() cannot handle that particular combination,
>> + * so we need two separate attempts.
>> + */
>> + p = mempool_alloc(nfs_commit_mempool, GFP_NOWAIT);
>> + if (!p)
>> + p = kmem_cache_alloc(nfs_cdata_cachep, GFP_NOIO |
>> + __GFP_NOWARN | __GFP_NORETRY);
>
> Do we need to add something to the nfs_commit_data structure to
> properly free a kmem_cache_alloc()-ed object? Right now it looks like
> nfs_commit_free() calls mempool_free() unconditionally.
Good question. I should have clarified that in the patch comment.
Can you add this to that comment please.
The objects returned by kmem_cache_alloc() will still be freed
by mempool_free(). This is safe as mempool_alloc() uses
exactly the same function to allocate objects (since the mempool
was created with mempool_create_slab_pool()). The object returned
by mempool_alloc() and kmem_cache_alloc() are indistinguishable
so mempool_free() will handle both identically, either adding to the
pool or calling kmem_cache_free().
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
prev parent reply other threads:[~2017-04-10 21:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-10 2:22 NeilBrown
2017-04-10 20:22 ` Anna Schumaker
2017-04-10 21:42 ` NeilBrown [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=87r310vt19.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=Anna.Schumaker@Netapp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.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®