Received: by 10.223.176.5 with SMTP id f5csp2694237wra; Thu, 1 Feb 2018 04:43:17 -0800 (PST) X-Google-Smtp-Source: AH8x227mXWLT+kYFlhYfq0I95TZh4/szZNhFURvk8kOxOo3pX5cj8vgzDPuPzdf5tui3S8e2nzRz X-Received: by 10.99.97.211 with SMTP id v202mr892165pgb.412.1517488997024; Thu, 01 Feb 2018 04:43:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517488996; cv=none; d=google.com; s=arc-20160816; b=RJVq/hoFoy2uRToSR24uTiGFXsoP2iuCpqT+jkcMJW0TzXcD4hyDunyEdX1HPKeZ+1 DW5u0O2bDpOg54Zh+5BCsKe9d7XbOH4gbptXulcjuIS+IsH6kOJR/JzBEiobt2GvitIq V2qvxnA+wso4qaGjVWjnva1StDLL4nkXIbGbbXZ91sVO5RtLivzyK4J3OUxLxM2D7XVg nCN9QfZeTH4FHnYtu0YL+TzzGvJCP6sQ6UQ+xMnrspBy0daAtOT5wZ+JWA3IsP629XxH Iv8ZR6kkbF9MYo0BpFGwyWnNLEncmWHJ3GHXUlor9TueYOOWzBBghaioLhdGnSCdqpPb E3FA== 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:from:references:cc:to:subject:arc-authentication-results; bh=QeuhxojymB60ACPVIgg0sTKmoG3+8bKcCMR0ZC+sJkw=; b=KWq1aIG9ZtiJLftkqw387oxl33E/AORkrHl43J32kE0atkhQ3DMqKZ8xcc4CKriWm/ j2vRZE3kNnxYna8Z1+PEe0mxIsd3tMR2Ucs6qnPzQDYUtjUFWYIH8IM0XQxZYIMrJ70W kwLeHlKMg0o/qNuCNZRV/3fYdh5g8UJULY05XFqb5xRNwO+Vygs7fdXAFth8Sa1W39+7 GRU3iTWdfOepth7/s1Ycs5lyeMB2WLx7RJ2C7iToVBX6nYHWdb10f5jIw+zKn0QDgl0u l9+rUzM5Nk2S3ItD68TIH0sdrziuppOSp4+9IQxyr28HE0OSu9fptJvix1P5s+Onzju5 WEuQ== 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 u27si1654000pfk.385.2018.02.01.04.43.02; Thu, 01 Feb 2018 04:43:16 -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 S1752546AbeBAMmg (ORCPT + 99 others); Thu, 1 Feb 2018 07:42:36 -0500 Received: from lhrrgout.huawei.com ([194.213.3.17]:24400 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752338AbeBAMmf (ORCPT ); Thu, 1 Feb 2018 07:42:35 -0500 Received: from LHREML714-CAH.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 68E3A6DBD296A; Thu, 1 Feb 2018 12:42:31 +0000 (GMT) Received: from [10.122.225.51] (10.122.225.51) by smtpsuk.huawei.com (10.201.108.37) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 1 Feb 2018 12:42:28 +0000 Subject: Re: [PATCH 3/6] struct page: add field for vm_struct To: Christopher Lameter CC: , , , , , , , , , References: <20180130151446.24698-1-igor.stoppa@huawei.com> <20180130151446.24698-4-igor.stoppa@huawei.com> From: Igor Stoppa Message-ID: <48fde114-d063-cfbf-e1b6-262411fcd963@huawei.com> Date: Thu, 1 Feb 2018 14:42:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 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 01/02/18 02:00, Christopher Lameter wrote: > On Tue, 30 Jan 2018, Igor Stoppa wrote: > >> @@ -1769,6 +1774,9 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align, >> >> kmemleak_vmalloc(area, size, gfp_mask); >> >> + for (page_counter = 0; page_counter < area->nr_pages; page_counter++) >> + area->pages[page_counter]->area = area; >> + >> return addr; > > Well this introduces significant overhead for large sized allocation. Does > this not matter because the areas are small? Relatively significant? I do not object to your comment, but in practice i see that: - vmalloc is used relatively little - allocations do not seem to be huge - there seem to be way larger overheads in the handling of virtual pages (see my proposal for the LFS/m summit, about collapsing struct vm_struct and struct vmap_area) > Would it not be better to use compound page allocations here? > page_head(whatever) gets you the head page where you can store all sorts > of information about the chunk of memory. Can you please point me to this function/macro? I don't seem to be able to find it, at least not in 4.15 During hardened user copy permission check, I need to confirm if the memory range that would be exposed to userspace is a legitimate sub-range of a pmalloc allocation. So, I start with the pair (address, size) and I must end up to something I can compare it against. The idea here is to pass through struct_page and then the related vm_struct/vmap_area, which already has the information about the specific chunk of virtual memory. I cannot comment on your proposal because I do not know where to find the reference you made, or maybe I do not understand what you mean :-( -- igor