From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88BFAC2D0A3 for ; Wed, 4 Nov 2020 12:37:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D0404223C7 for ; Wed, 4 Nov 2020 12:37:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="DdiM6pmP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0404223C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 26D726B0068; Wed, 4 Nov 2020 07:37:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2266C6B006C; Wed, 4 Nov 2020 07:37:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 15C6A6B006E; Wed, 4 Nov 2020 07:37:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0107.hostedemail.com [216.40.44.107]) by kanga.kvack.org (Postfix) with ESMTP id D37376B0068 for ; Wed, 4 Nov 2020 07:37:09 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 778BF1EE6 for ; Wed, 4 Nov 2020 12:37:09 +0000 (UTC) X-FDA: 77446685778.27.bone79_4b047f3272c1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 586BE3D669 for ; Wed, 4 Nov 2020 12:37:09 +0000 (UTC) X-HE-Tag: bone79_4b047f3272c1 X-Filterd-Recvd-Size: 3898 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Wed, 4 Nov 2020 12:37:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=69FU7ghO8WjsOmkJBEaPXkg/5I7NmXJk48zGhGZfh5c=; b=DdiM6pmP17iaTQZK78CwSqwIdk ftBOvVdB7bDIbJ+/LFWc0maCiKEb6La4jbRQ+hM0NuiZbuxbhdUfJAu3PCNVw5N5ACpN2nkfVT3pP Q0o0ElPhsQ5maVjWWZsn1qYX62TrhRHI8n5cv9cqrCeX5ianDOn9piz6dhjNF9ajB8An0+QKFGQ9t /fnk4EznR60SFOCWUTfhbgUsR85pvt9wHSfhSyRcJUIczRqAwj/b0xGy4VONVBqf2zpaNoSGlHwke its7Dq1AFdh7JA3Qb64jfDFPJ4EshK67PoVZulrhb/P7lSrlx/Q9RmJMPRY5Be9iAnQYX+JkluPy/ 5StLcHog==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kaI27-0005YU-Ea; Wed, 04 Nov 2020 12:36:59 +0000 Date: Wed, 4 Nov 2020 12:36:59 +0000 From: Matthew Wilcox To: Eric Dumazet Cc: Rama Nichanamatlu , Dongli Zhang , linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, davem@davemloft.net, kuba@kernel.org, aruna.ramakrishna@oracle.com, bert.barbe@oracle.com, venkat.x.venkatsubra@oracle.com, manjunath.b.patil@oracle.com, joe.jin@oracle.com, srinivas.eeda@oracle.com Subject: Re: [PATCH 1/1] mm: avoid re-using pfmemalloc page in page_frag_alloc() Message-ID: <20201104123659.GA17076@casper.infradead.org> References: <20201103193239.1807-1-dongli.zhang@oracle.com> <20201103203500.GG27442@casper.infradead.org> <7141038d-af06-70b2-9f50-bf9fdf252e22@oracle.com> <20201103211541.GH27442@casper.infradead.org> <20201104011640.GE2445@rnichana-ThinkPad-T480> <2bce996a-0a62-9d14-4310-a4c5cb1ddeae@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <2bce996a-0a62-9d14-4310-a4c5cb1ddeae@gmail.com> Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Nov 04, 2020 at 09:50:30AM +0100, Eric Dumazet wrote: > On 11/4/20 2:16 AM, Rama Nichanamatlu wrote: > >> Thanks for providing the numbers.=A0 Do you think that dropping (up = to) > >> 7 packets is acceptable? > >=20 > > net.ipv4.tcp_syn_retries =3D 6 > >=20 > > tcp clients wouldn't even get that far leading to connect establish i= ssues. >=20 > This does not really matter. If host was under memory pressure, > dropping a few packets is really not an issue. >=20 > Please do not add expensive checks in fast path, just to "not drop a pa= cket" > even if the world is collapsing. Right, that was my first patch -- to only recheck if we're about to reuse the page. Do you think that's acceptable, or is that still too close to the fast path? > Also consider that NIC typically have thousands of pre-allocated page/f= rags > for their RX ring buffers, they might all have pfmemalloc set, so we ar= e speaking > of thousands of packet drops before the RX-ring can be refilled with no= rmal (non pfmemalloc) page/frags. >=20 > If we want to solve this issue more generically, we would have to try > to copy data into a non pfmemalloc frag instead of dropping skb that > had frags allocated minutes ago under memory pressure. I don't think we need to copy anything. We need to figure out if the system is still under memory pressure, and if not, we can clear the pfmemalloc bit on the frag, as in my second patch. The 'least change' way of doing that is to try to allocate a page, but the VM could export a symbol that says "we're not under memory pressure any more". Did you want to move checking that into the networking layer, or do you want to keep it in the pagefrag allocator?