Received: by 10.223.185.116 with SMTP id b49csp6602737wrg; Wed, 28 Feb 2018 12:10:54 -0800 (PST) X-Google-Smtp-Source: AG47ELs/ss2YS1OzE9GvfuDTXKe/cKfOIdVBZNhoOVG3KnSLJOVjMyH7usUlZn/rRylOK/c7vFtv X-Received: by 10.99.42.207 with SMTP id q198mr7143747pgq.186.1519848654349; Wed, 28 Feb 2018 12:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519848654; cv=none; d=google.com; s=arc-20160816; b=tRj5yeelTPLdwlFhbI70bK5oURdbpsCwTq4pAO1kkzLDnhWyoB5ecH6FskGpmZbazO RSJShWVE43k8AsVO4Qj0R7mZmVFyuETMPzbRGxKUB8AJW6aYqFDKAeUvzSMAsypRUsrP UMZ6EW2d1tFRGkRrMNlg0m48LZENn8REdIUCNwek4GkQ59AcsNoga7xs248YO7lQXV7A bxKcjgDe7/jq7fZNAaSihofiZdqWIY+HKQhBmfrHjEtwN5TJZXgLMjN+0V0K1Korn+HW lfGeMvc2iKI7p0kdcI1duh+5FxDciZ/Yf1rPKdR3dYE551YsP/dWuYIYYST4o5c5r8Xz kE7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=0ZPkcyfim2K9mLs2OIErsKfhv9YVlWEcOMnBP2fHwcA=; b=OZw0qOD3yqdeJOANl1BFsE9rhLbmvWkGSutFPC5qRynNMnVwjm0RgFZaOEynEyniki h646lihcs+BPPvUX3pFPTBJkohFpPICwzGAe1UUTgXlWdVQKTCzS+Tnq3kN+YMMdz1TU 3ZjElPE45hf95wHDcvnxBXLab8HmHHeFTedSAO+blwRRfcd/zEChmlYo+9FHrGORa+Bq U8ULRIM7auaWGCm6Mc21Kbva0UK3OjnCY3RtGw2iGtV7go1wgOndu/I3K+HKEhMiJSmB lovQh3re7Cjk4puwbbE+Aqqi9JIpT7pF7qzBd5T74W+rDUvFUchAPDhTOpvBhKZYU44Y D5tw== 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 r62si1692747pfe.400.2018.02.28.12.10.39; Wed, 28 Feb 2018 12:10:54 -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 S934396AbeB1UI3 (ORCPT + 99 others); Wed, 28 Feb 2018 15:08:29 -0500 Received: from lhrrgout.huawei.com ([194.213.3.17]:27895 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933981AbeB1UI1 (ORCPT ); Wed, 28 Feb 2018 15:08:27 -0500 Received: from LHREML712-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 4545F5E66F550; Wed, 28 Feb 2018 20:08:24 +0000 (GMT) Received: from localhost.localdomain (10.122.225.51) by smtpsuk.huawei.com (10.201.108.35) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 28 Feb 2018 20:08:20 +0000 From: Igor Stoppa To: , , , CC: , , , , , Igor Stoppa Subject: [PATCH 3/7] struct page: add field for vm_struct Date: Wed, 28 Feb 2018 22:06:16 +0200 Message-ID: <20180228200620.30026-4-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180228200620.30026-1-igor.stoppa@huawei.com> References: <20180228200620.30026-1-igor.stoppa@huawei.com> MIME-Version: 1.0 Content-Type: text/plain 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 When a page is used for virtual memory, it is often necessary to obtain a handler to the corresponding vm_struct, which refers to the virtually continuous area generated when invoking vmalloc. 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, later on. Signed-off-by: Igor Stoppa --- include/linux/mm_types.h | 1 + mm/vmalloc.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index fd1af6b9591d..c3a4825e10c0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -84,6 +84,7 @@ struct page { void *s_mem; /* slab first object */ atomic_t compound_mapcount; /* first tail page */ /* page_deferred_list().next -- second tail page */ + struct vm_struct *area; }; /* Second double word */ diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ebff729cc956..61a1ca22b0f6 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1536,6 +1536,7 @@ static void __vunmap(const void *addr, int deallocate_pages) struct page *page = area->pages[i]; BUG_ON(!page); + page->area = NULL; __free_pages(page, 0); } @@ -1705,6 +1706,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, area->nr_pages = i; goto fail; } + page->area = area; area->pages[i] = page; if (gfpflags_allow_blocking(gfp_mask|highmem_mask)) cond_resched(); -- 2.14.1