Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp867131rwb; Thu, 22 Sep 2022 07:22:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JUzUDvL078TK1Tfu27axH0lFp2geKFZZbWOWAhVQTU8cN7gGKDr8ih886+pcSc3ewOhbI X-Received: by 2002:a17:907:7209:b0:780:33b4:43a5 with SMTP id dr9-20020a170907720900b0078033b443a5mr3156177ejc.547.1663856525843; Thu, 22 Sep 2022 07:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663856525; cv=none; d=google.com; s=arc-20160816; b=KkRSlV02UXPSaZVN/dYkRrou5Ayp9ZvB4XmF/PE4jHhF4aCrZyhUqKbHWjLl6ioBBP wfyduxLSN+taBQTglUSgB8XdANv52Bkd9Ic8kbVU0Y8avBDmhuRaCaCwfhW14FGtuUdT rqTYaQW08fpv3A33eTUWDw0DrC7A6iSl7f0emTMx8U7Kmmx8V2PvbERqGJbQnSUjjxBj yM9RtHoONw02eWCEKbNs+gBF2yfetqzTUQsg2amDSWXQhRKd26fgbRA7998mOy6c1JO3 cD6M+k/I4z3MQ3QB5ra0uHSEfciHlLUw/5TDp+pXniJrit4LW3thJKLq56aiPVR7zDKi Xzrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=csaDTRy6D0rgazJxGh5NAOOWkO2ONFlpEf7iu8qiadM=; b=aUW2XOjnlN2RPh3gHaouPEjsqEy//L+1R/FNj1tFJ0b6utee/X29oTZRu8hN0vYt8Z cCkekLT+wJCZRhoS6433adf1com73AxqZ4o186BKiPBEMVifVxofrSZ1aZlXmc2Ib+hl AHJsRHfWus0LbEtqMBAjo88xNO92d3j/3mRPjBeseK3srtspofH4rhYo1RT0UCj9qDRX WilEvwfShtncLyWE1Tfmh88oyn5TUDWqe1UCDjiJhwFBYDzxMyJwyjwPjjlWPNV7+Pnu YsDFf7UJYAq0NUocYHtvHiJwxnJkI14iXoeAKe4tyE4aezax4LUzBlRO9QKjrz1N71Te /vEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fyS3rsSw; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t1-20020aa7d4c1000000b004548de98792si5007675edr.570.2022.09.22.07.21.34; Thu, 22 Sep 2022 07:22:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fyS3rsSw; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbiIVOQE (ORCPT + 99 others); Thu, 22 Sep 2022 10:16:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231460AbiIVOQB (ORCPT ); Thu, 22 Sep 2022 10:16:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E64BF313E for ; Thu, 22 Sep 2022 07:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663856159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=csaDTRy6D0rgazJxGh5NAOOWkO2ONFlpEf7iu8qiadM=; b=fyS3rsSwGBeUIJy4i2++uIK+pco1Bkff7/S5WjvPlBOXpKDVZfhgJqeQlWKcg0T+VgcfUd hypDYjj+P/yO3MsXZbFIPS6KWgOv7KLOOBNRKvivUW5iKQ86yJhQSKKiWjajKaiPUroXV+ LXfkzPXi1yw8yL46Fv0zrQKZiof/qCc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-5-UTAZqnfgN-u33fNF4J6Dbg-1; Thu, 22 Sep 2022 10:15:54 -0400 X-MC-Unique: UTAZqnfgN-u33fNF4J6Dbg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C4D56185A7A3; Thu, 22 Sep 2022 14:15:53 +0000 (UTC) Received: from [172.16.176.1] (unknown [10.22.48.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 414422028CE4; Thu, 22 Sep 2022 14:15:52 +0000 (UTC) From: "Benjamin Coddington" To: "Guillaume Nault" Cc: "David Miller" , "Jakub Kicinski" , "Paolo Abeni" , "Eric Dumazet" , netdev@vger.kernel.org, "Chuck Lever" , "Jeff Layton" , "Trond Myklebust" , "Anna Schumaker" , linux-nfs@vger.kernel.org Subject: Re: [PATCH net] sunrpc: Use GFP_NOFS to prevent use of current->task_frag. Date: Thu, 22 Sep 2022 10:15:51 -0400 Message-ID: In-Reply-To: <96a18bd00cbc6cb554603cc0d6ef1c551965b078.1663762494.git.gnault@redhat.com> References: <96a18bd00cbc6cb554603cc0d6ef1c551965b078.1663762494.git.gnault@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 21 Sep 2022, at 8:16, Guillaume Nault wrote: > Commit a1231fda7e94 ("SUNRPC: Set memalloc_nofs_save() on all > rpciod/xprtiod jobs") stopped setting sk->sk_allocation explicitly in > favor of using memalloc_nofs_save()/memalloc_nofs_restore() critical > sections. > > However, ->sk_allocation isn't used just by the memory allocator. > In particular, sk_page_frag() uses it to figure out if it can return > the page_frag from current or if it has to use the socket one. > With ->sk_allocation set to the default GFP_KERNEL, sk_page_frag() now > returns current->page_frag, which might already be in use in the > current context if the call happens during memory reclaim. > > Fix this by setting ->sk_allocation to GFP_NOFS. > Note that we can't just instruct sk_page_frag() to look at > current->flags, because it could generate a cache miss, thus slowing > down the TCP fast path. > > This is similar to the problems fixed by the following two commits: > * cifs: commit dacb5d8875cc ("tcp: fix page frag corruption on page > fault"). > * nbd: commit 20eb4f29b602 ("net: fix sk_page_frag() recursion from > memory reclaim"). > > Link: = > https://lore.kernel.org/netdev/b4d8cb09c913d3e34f853736f3f5628abfd7f4b6= =2E1656699567.git.gnault@redhat.com/ > Fixes: a1231fda7e94 ("SUNRPC: Set memalloc_nofs_save() on all = > rpciod/xprtiod jobs") > Signed-off-by: Guillaume Nault Looks good, and thanks for looking through all the options. Reviewed-by: Benjamin Coddington Ben