Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp713231rwb; Sun, 6 Nov 2022 12:32:27 -0800 (PST) X-Google-Smtp-Source: AMsMyM7ANgjdilDcXKfJSzP1ma2E/vyDcRNYxVT4Us2XXTV++JPN2D+nmIcVJ31f+eSE65BanZqZ X-Received: by 2002:a05:6402:1a48:b0:461:900a:7f0d with SMTP id bf8-20020a0564021a4800b00461900a7f0dmr46684784edb.125.1667766747041; Sun, 06 Nov 2022 12:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667766747; cv=none; d=google.com; s=arc-20160816; b=Pv0ADIMRmyv+KK5kYO8HcTeSPMdwIFTTZzhuxpLE+U46CAZMFk4G8QueiavL8XRoji e5+ydJQW8lgRQIRMxigGWYjt4DnFO2smqzexCCm1UTKGRLXAw+j5R6rBiK+vQVRiKYUr 45uIq2i1ofgfVwwFK2QYBFWvqykea0zPzED1WmajwXHcOeEXEnP9pGMs0snrpgBe19dp NX1csZS5oDUFkThak/TJ2i6JEFN/6H84RwHDfLKGI1lXCMI7tgu0UxJ8kZJlckACurcD QOt9vIzfqjglCgGblSkBrWiyTRxMbo4CSIuxUzUtx+mtJVGnwuDaifE07pvM2d+rnbvQ kQ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=Z6oRYbVeFw0g+nrdQFitukonMwA9rcY/1A4nrqySmrs=; b=XD22p35Y8Y+JWVrOoYjtbXQ7FfW39rOXzxzRuj01cKouIXLn6Yl+OuEEDRcjLRIAWn 9DIR1LgQDAcVPTCpKvW9NPeTj2BIr7rDsRFj2Iqtb7NbqAK0VVKCgU8A8bG6LWCIkFJy /3FLZOHMlHDmMU/j6P/NSbP0dUBpjCXmPTeI7iCcjiGp+fUfRvlO4cnQVs7kQBFWzwT/ VxZJWX114uul1OM0EL/qyMFF70WddbiSo7n0Ayz5NtBwR0ckyhq1zVEgSpPZOF91Ol1W RO9yPI9wQNTGFA2quEL9WK4Gspj9sStKcRn2uIx7XHA0dp7sr82iq0uPgZt+n6sPFnu/ GPmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=faJzqqiq; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sb36-20020a1709076da400b00770534b5a71si7587839ejc.858.2022.11.06.12.31.57; Sun, 06 Nov 2022 12:32:27 -0800 (PST) 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=@sberdevices.ru header.s=mail header.b=faJzqqiq; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbiKFTog (ORCPT + 95 others); Sun, 6 Nov 2022 14:44:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbiKFToe (ORCPT ); Sun, 6 Nov 2022 14:44:34 -0500 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 827DC5FF0; Sun, 6 Nov 2022 11:44:32 -0800 (PST) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 9F4DF5FD04; Sun, 6 Nov 2022 22:44:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1667763870; bh=Z6oRYbVeFw0g+nrdQFitukonMwA9rcY/1A4nrqySmrs=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=faJzqqiq51dEe/HKUIM/zX8RewjNgVOscJEuKRN+PlyILw5cb/A/FUZF3YERwAump oXJ1PEKjynCZDt/PxN1O/ckwIpeuIOlxEvodJdn2S+szcHzmBxlJzw/L7Y9wCJeHvE IjZsCXHBOr0W3UfY6Pj9uZ46Dc0penD7JmXB6GWmGFBRgDI/V3Ewsn8xY6ckK3+f2W M/ug+yD9yziT0p0aIRXThpGhlBpnKub6ZKePZHjik+VN9MUJ44NVexH9cIa6LZwxig IMOR8z08s89EHLQY9k/0cARdGDW/pr6a3oSIbCh0mMr/BZ4q8mlksU9VGXnfclUa9j 3BojpOMUhyRfA== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mx.sberdevices.ru (Postfix) with ESMTP; Sun, 6 Nov 2022 22:44:30 +0300 (MSK) From: Arseniy Krasnov To: Stefano Garzarella , Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , "edumazet@google.com" , Jakub Kicinski , Paolo Abeni , Krasnov Arseniy CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , kernel Subject: [RFC PATCH v3 05/11] vhost/vsock: switch packet's buffer allocation Thread-Topic: [RFC PATCH v3 05/11] vhost/vsock: switch packet's buffer allocation Thread-Index: AQHY8hgdDSQFggGg1UqSYuJmlIYHyQ== Date: Sun, 6 Nov 2022 19:43:59 +0000 Message-ID: <6ec232ab-fcc6-3afb-8c38-849ad25ef6c5@sberdevices.ru> In-Reply-To: Accept-Language: en-US, ru-RU Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] Content-Type: text/plain; charset="utf-8" Content-ID: <4547A82DCB7E9943BE87B15E62BD6DE3@sberdevices.ru> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/11/06 12:52:00 #20573807 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 VGhpcyBjaGFuZ2VzIHBhY2tldHMgYnVmZmVyIGFsbG9jYXRpb24gbG9naWMsaXQgZGVwZW5kcyBv biB3aGV0aGVyIHJ4DQp6ZXJvY29weSBlbmFibGVkIG9yIGRpc2FibGVkIG9uIGRlc3RpbmF0aW9u IHNvY2tldC4gVGh1cywgbm93IHNvY2tldA0KbG9va3VwIHBlcmZvcm1lZCBoZXJlLCBub3QgaW4g J3ZpcnRpb190cmFuc3BvcnRfY29tbW9uLmMnLCBhbmQgZm9yDQp6ZXJvY29weSBjYXNlLCBidWZm ZXIgaXMgYWxsb2NhdGVkIHVzaW5nIHJhdyBjYWxscyB0byB0aGUgYnVkZHkNCmFsbG9jYXRvci4g SWYgemVyb2NvcHkgaXMgZGlzYWJsZWQsIHRoZW4gYnVmZmVycyBhbGxvY2F0ZWQgYnkNCidrbWFs bG9jKCknKGxpa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