From patchwork Tue Mar 15 16:20:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12781635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2176C433EF for ; Tue, 15 Mar 2022 16:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241810AbiCOQ2e (ORCPT ); Tue, 15 Mar 2022 12:28:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241023AbiCOQ2d (ORCPT ); Tue, 15 Mar 2022 12:28:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5ED3056C07 for ; Tue, 15 Mar 2022 09:27:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0313061478 for ; Tue, 15 Mar 2022 16:27:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E9D1C340E8 for ; Tue, 15 Mar 2022 16:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647361640; bh=LJGKS8YVRr2Wfr6Fi2nX8NOxhr6HXNOjzyrtXMP0Y/M=; h=From:To:Subject:Date:From; b=CTnklopFV7w4+pxcdREnvr6qpzmD6W/bQHSdit7No28SQ0cvYUiFKsBLnBLqREl+6 Mf0jW1N5RWFnrGB6S+3O22Z3NsYjs8aJaYXscgz/tHDK83+Eq49zaO8IH1dQZ37/6D VRhvn76RkQgk9hYNE2eL4jSrELIpmx1SkegEcnr8sbivrLbIA1ALwNrCczU7MVQFwz wTLE+DHYOvhH77uKsjZ8T2IbsKzpqGjUhjCZ1uV52ySYt9DVEd/iQOrB2wQW65LTtN zKqHFSgu734U5YXzbUlR/6McbPCa301F/QKmIRXZigg7xdij90f1lwSRl1pct/uuLu +YqiJ+JUGf2Zw== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH] NFS: Fix memory allocation in rpc_malloc() Date: Tue, 15 Mar 2022 12:20:52 -0400 Message-Id: <20220315162052.570677-1-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust When allocating memory, it should be safe to always use GFP_KERNEL, since both swap tasks and asynchronous tasks will regulate the allocation mode through the struct task flags. Signed-off-by: Trond Myklebust --- net/sunrpc/sched.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 7c8f87ebdbc0..c62fcacf7366 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -1030,16 +1030,12 @@ int rpc_malloc(struct rpc_task *task) struct rpc_rqst *rqst = task->tk_rqstp; size_t size = rqst->rq_callsize + rqst->rq_rcvsize; struct rpc_buffer *buf; - gfp_t gfp = GFP_KERNEL; - - if (RPC_IS_ASYNC(task)) - gfp = GFP_NOWAIT | __GFP_NOWARN; size += sizeof(struct rpc_buffer); if (size <= RPC_BUFFER_MAXSIZE) - buf = mempool_alloc(rpc_buffer_mempool, gfp); + buf = mempool_alloc(rpc_buffer_mempool, GFP_KERNEL); else - buf = kmalloc(size, gfp); + buf = kmalloc(size, GFP_KERNEL); if (!buf) return -ENOMEM;