Received: by 10.223.185.116 with SMTP id b49csp1026668wrg; Tue, 20 Feb 2018 11:54:56 -0800 (PST) X-Google-Smtp-Source: AH8x227e3r+pmtSdxAQ7hnve1v7/wIRq90Nr3xdEZs1y+zfaSGdYXs6AWAh6vod4ht0R2uHvq8wu X-Received: by 10.99.124.7 with SMTP id x7mr592582pgc.356.1519156496139; Tue, 20 Feb 2018 11:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519156496; cv=none; d=google.com; s=arc-20160816; b=xZ7HbFxUfa1zE2XdvpYdf6Gq0VYAm+evLMMTDYMjWaHbrF1p387wyPLzPyyi0mD1Vy PAmRJbx+LiyiIuMNFQwdw1S8SfbRtwS73vyx4oJoc2KdJ6SujCeOCPWR6m73OlbBDGDG NS0ipAlc90HOahovFw8AAt+O5ayb1OKtbmWBPXpAonq/Y5OinEIfvajKzrnZ9DqwViBo LRrZGVF2mefo7zYTH4dPDbQLwOAf3G6b2bDFeNVUKy1vodKzK6ndavxZSHl8a0BgS0vr NfDhRyM2AMNbhQYkUjqnIzVw+fbgE0xO/Kwgh3n0K+lQgRdsW13QiS1hUmFpru8Ks+fr dr8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=0GRIHCJnV5n1crTNIQgxVdgsfy1NIVPAbku/Zm/MXPo=; b=ndHZK5ELzb7CkTvFRHwGfmCYIqXArHAzFVId51FdYISdcKzL7YZpL1jFwuDRCzvJWJ QoWdCANCBNx0Xka2ahPig6BrmoRQSZ7pPA/JKLJsmZAOUShQFXkV8Qp8V2VM1T9vU59L j/eX4ju+feN2tQgnXY4em56O9XRE3q66229wSgIFlwIfEkT+pXk7ot6YSELCHtZLR740 5+swPLm5Ltznbg2RA9KItN21R4kzmnubcEcfPu1pYWHGjUE8IINrJw6QoweJ1fUJOToX TRF2q2qcmUINUeeF/THrR0g/0fzrMA2J/Twtqq0G1zPOZXuLD8tmvlHP9uu4Obr8Heak 6r1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi1-v6si10900889plb.393.2018.02.20.11.54.41; Tue, 20 Feb 2018 11:54:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751320AbeBTTyB (ORCPT + 99 others); Tue, 20 Feb 2018 14:54:01 -0500 Received: from lhrrgout.huawei.com ([194.213.3.17]:26901 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750799AbeBTTyA (ORCPT ); Tue, 20 Feb 2018 14:54:00 -0500 Received: from LHREML712-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 3C0D712A158A3; Tue, 20 Feb 2018 19:53:56 +0000 (GMT) Received: from [10.122.225.51] (10.122.225.51) by smtpsuk.huawei.com (10.201.108.35) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 20 Feb 2018 19:53:53 +0000 Subject: Re: [PATCH 3/6] struct page: add field for vm_struct From: Igor Stoppa To: Matthew Wilcox CC: , , , , , , , , , , , References: <20180211031920.3424-1-igor.stoppa@huawei.com> <20180211031920.3424-4-igor.stoppa@huawei.com> <20180211211646.GC4680@bombadil.infradead.org> Message-ID: Date: Tue, 20 Feb 2018 21:53:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.122.225.51] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/02/18 18:24, Igor Stoppa wrote: > > > On 11/02/18 23:16, Matthew Wilcox wrote: >> On Sun, Feb 11, 2018 at 05:19:17AM +0200, Igor Stoppa wrote: >>> The struct page has a "mapping" field, which can be re-used, to store a >>> pointer to the parent area. This will avoid more expensive searches. >>> >>> As example, the function find_vm_area is reimplemented, to take advantage >>> of the newly introduced field. >> >> Umm. Is it more efficient? You're replacing an rb-tree search with a >> page-table walk. You eliminate a spinlock, which is great, but is the >> page-table walk more efficient? I suppose it'll depend on the depth of >> the rb-tree, and (at least on x86), the page tables should already be >> in cache. > > I thought the tradeoff favorable. It turns out that it's probably not so favorable. The patch relies on the function vmalloc_to_page ... which will return NULL when applied to huge mappings, while the original implementation will still work. It was found while testing on a configuration with framebuffer. So it seems unlikely that there is any gain to be had, from this perspective. The use of the field still makes sense from the perspective of adding pmalloc support to hardened usercopy, but there is no more need for the field to exist as separate patch. This patch can be simplified and merged with the pmalloc patch. -- igor