Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2236498pxb; Sun, 24 Apr 2022 08:37:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqwwsKedVGR+G+KuIggowGWzXP+3eyYvcKzKSkEe5WMFuzmXXvgJ42i20J1vNwbhkLDdXH X-Received: by 2002:a17:907:9616:b0:6f3:927c:d1ef with SMTP id gb22-20020a170907961600b006f3927cd1efmr1644820ejc.375.1650814620861; Sun, 24 Apr 2022 08:37:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650814620; cv=none; d=google.com; s=arc-20160816; b=ct+P6MXy+EBRaOlsw9hNzL1m0OQ+Fx+yeOYDWVN8Ol2D5pGFqC0SXCVz9xXrjRWpNT wJ9vgQ2apgXY67biy7q58dkxtvSdinAQk0cfC3M0aX0rW1Txtxm/0jyUmzdQbj5kpsbW 8pG3shGFxiVKoFpXc+bB7/78e/RhjDKavXbgwc2dwoW806WkMbnHZRSssAbxynCueVbO KAjPR4XvJLCY9FAZ+jojlD2cmF7Rgkpx32I0bnJB9gIZFlds5Z9xfjuZj7SGxaoT/4dk NVJ6JCEmfjrX+4+vmS5M+O0QFGPR249V7K1VzVnx/zE25wpDB/Rl3nfSgT+WYzvWcLNi mcfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=o1IbIo9g2avy7esoGs8UpolEry/ei+Irc3zRH03DXPA=; b=FaJZUEX4nc4r94IJBXdZ4xNvv83xwiiM5eY+b/iWjk586qvZEvmbp0IN72XWLCWKk5 Hnft8Sx9zhqzefhkC4cpt361zkwckcSvqG7VX+BcjHhZIDna0BAKKGjCjrLDpXtYxu5W Vu3Tm8IAryMl1eiCW6uBxIfVaD54McHwZrhPYRA61Gle9xRfIP2YQMHtCjOgvXcRkD2a S0IODQn3VXY64I2LPIQI6r92btyU232xBRaSpb40Iv6Bx1xamMGXrgjteOVQ4Vebz8Ff gml+jgE4ekuycy+se4jV+gf6HPkuGgbnQnPdTYtGP4bsc7SOq9QXAxpMPKtSqu1uTxSy ohqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="j/YCjwc0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m12-20020a1709062b8c00b006e87643da69si10920141ejg.746.2022.04.24.08.36.35; Sun, 24 Apr 2022 08:37:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20210112 header.b="j/YCjwc0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237005AbiDWU0l (ORCPT + 99 others); Sat, 23 Apr 2022 16:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236995AbiDWU0j (ORCPT ); Sat, 23 Apr 2022 16:26:39 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9E3F1D83A5 for ; Sat, 23 Apr 2022 13:23:41 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id j8so18343047pll.11 for ; Sat, 23 Apr 2022 13:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o1IbIo9g2avy7esoGs8UpolEry/ei+Irc3zRH03DXPA=; b=j/YCjwc0EXUxe8lPb6euKJQxi21je7n75sq8x/F9BEt9kOnWBI3fHFW+FOHPp5mrW4 saYJtCKfXXIUFNhCw5SQ+tNrle8QjQC7DXOwOKt3gjqDU5DYZTb69PnImd1H1oXY8vDz tDicPj1UXn+dEirSKTLc0vO648sTJqta8Q90xItG/eEfADFVUeW/lPWF1klF9vp/ImKI dX77IpsO/FuZRRZL7hWlUbJZzUz+rRZBW8kBjw+q3i/zXWLIbOhho6K7aqrunWIkytQl EfaMaIdnT7/cExv5jqUAt6BEp/wcIN3flwKq7NO8fjJvLWvTgfnXjrqah9CXNl2rbFBJ yF0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o1IbIo9g2avy7esoGs8UpolEry/ei+Irc3zRH03DXPA=; b=7IPhTWQ1HXojMybqrlcRl8gf2XM67BCA/Sd7zRArUwJJGbNNOAqBZjDyfnYR3tYsbV eoNieGMFAXmdLdaIJvXtI5YL+EpXFcHogRTTHwCqCwsytbutzrNw/PZMoYC8BJRy+YDx INOEDnX3oHlQMterUzmTjoRZBHlVuf3q6cQrtBu76A1wu1UD2twIQQ4zUIAAM0SN2xxN i1sD0mXLuJO7J0sb2jOrxxdPkQoekzuOny4ECRWP6dJEtBLgvihxJdTfQGEdTs4clVIZ YnDmSf96u3eEZq+VyUOLwnbjkW12d/Cv5CKXHHINFxzJDjkEv3RbSG3q7XVQH1PqnqWC ebXA== X-Gm-Message-State: AOAM533TRdWR28o0UU+hwHMnEe67fmegWWLcy8FkcDuim08PrGws9fFd 2Sf4+IYF75KqxeI+09qHVqswFkexTeIBy5oKOe8= X-Received: by 2002:a17:90b:1c86:b0:1bf:2a7e:5c75 with SMTP id oo6-20020a17090b1c8600b001bf2a7e5c75mr12322109pjb.145.1650745420880; Sat, 23 Apr 2022 13:23:40 -0700 (PDT) MIME-Version: 1.0 References: <20220420073717.GD16310@xsang-OptiPlex-9020> In-Reply-To: From: Andrei Vagin Date: Sat, 23 Apr 2022 13:23:27 -0700 Message-ID: Subject: Re: [fs/pipe] 5a519c8fe4: WARNING:at_mm/page_alloc.c:#__alloc_pages To: Linus Torvalds Cc: kernel test robot , Dmitry Safonov <0x7f454c46@gmail.com>, Alexander Viro , Andrew Morton , LKML , lkp@lists.01.org, kernel test robot , Mike Rapoport , Pavel Emelyanov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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-kernel@vger.kernel.org On Fri, Apr 22, 2022 at 10:23 AM Linus Torvalds wrote: > > On Thu, Apr 21, 2022 at 10:23 PM Andrei Vagin wrote: > > > > The big advantage of vmsplice is that it can attach real user pages into > > a pipe and then any following changes of these pages by the process > > don't trigger any allocations and extra copies of data. vmsplice in this > > case is fast. After splicing pages to pipes, we resume a process and > > splice pages from pipes to a socket or a file. The whole process of > > dumping process pages is zero-copy. > > Hmm. What happens if you just use /proc//mem? > > That just takes a reference to the tsk->mm. No page copies at all. > After that you can do anything you want to that mm. > > Well, anything a /proc//mm fd allows, which is mainly read and > write. But it stays around for as long as you keep it open, and > fundamentally stays coherent with that mm, because it *is* that mm. > > And it doesn't affect anything else, because all it literally has is > that mm_struct pointer. I think the main reason for using vmsplice&splice was zero-copy. I wrote a small benchmark to compare /proc/pid/mem, process_vm_readv, and vmsplice. This benchmark emulates how criu dumps memory. It creates a child process and dumps its memory into a file. The code is here: https://github.com/avagin/procmem. Here are results from my laptop: $ ./procmem [CMD] [DUMP FILE] [BUF_SIZE] [MEM_SIZE] $ ./procmem splice /tmp/procmem.out 1048576 2147483648 ok 4877 MB/sec ok 4733 MB/sec ok 4777 MB/sec ok 4766 MB/sec ok 4821 MB/sec ok 4777 MB/sec ok 4798 MB/sec ok 4798 MB/sec ok 4798 MB/sec ok 4798 MB/sec $ ./procmem mem /tmp/procmem.out 1048576 2147483648 ok 3236 MB/sec ok 2651 MB/sec ok 3216 MB/sec ok 3211 MB/sec ok 3216 MB/sec ok 3206 MB/sec ok 3211 MB/sec ok 3216 MB/sec ok 3206 MB/sec ok 3211 MB/sec $ ./procmem process_vm_readv /tmp/procmem.out 1048576 2147483648 ok 3833 MB/sec ok 3075 MB/sec ok 3792 MB/sec ok 3792 MB/sec ok 3819 MB/sec ok 3813 MB/sec ok 3819 MB/sec ok 3806 MB/sec ok 3799 MB/sec ok 3813 MB/sec vmsplice & splice is the best. /proc/pid/mem is 30% slower. process_vm_readv is 20% slower. Thanks, Andrei