From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 789FEC433DF for ; Mon, 29 Jun 2020 14:53:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3AD5E23E53 for ; Mon, 29 Jun 2020 14:53:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="vgyw8ooe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3AD5E23E53 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AB8FA6B002D; Mon, 29 Jun 2020 10:53:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A68E66B002F; Mon, 29 Jun 2020 10:53:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97E546B0031; Mon, 29 Jun 2020 10:53:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 7CDE86B002D for ; Mon, 29 Jun 2020 10:53:12 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F1E24180AD81A for ; Mon, 29 Jun 2020 14:53:11 +0000 (UTC) X-FDA: 76982542182.12.chair06_411503e26e70 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id C6C3518005B03 for ; Mon, 29 Jun 2020 14:53:11 +0000 (UTC) X-HE-Tag: chair06_411503e26e70 X-Filterd-Recvd-Size: 3016 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Mon, 29 Jun 2020 14:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2qpcCa8MJg4RGNN56Q/d+ivYnFyOiwqo1KyRA7BzBV0=; b=vgyw8ooeBxvbbx1tvGAqheUNpE iZm0cPR07NIHG88nl21+XoWVDFANiLlRND6iBxJr7mLKh/64vEy/ByvsVvp5Ha5GuEmA8DfCCSNHh yd9yeSfEplwNyhkTrJRg22LHUmOVBeLx8vVFgx01np+u8kynp5NmZIXGrXQ4t6EDDS5zVXjcwQpi1 pjTOrWQNGJAdVq3sGLX/bb5XiqlVrv6PmZyAGWkyYF/R10vHSuaCGFnguuqBrwInV6dEY380+4Ngc fzzcNRM79hCVFnyavLL00eNYmD3dir0sKvN8fLZVx9FMUWAsolwiYBZbePDHfa6CE9vP9iF2T4oev oU4cYKAw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpv9X-0002I4-HS; Mon, 29 Jun 2020 14:52:59 +0000 Date: Mon, 29 Jun 2020 15:52:59 +0100 From: Matthew Wilcox To: Christopher Lameter Cc: Long Li , penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1] mm:free unused pages in kmalloc_order Message-ID: <20200629145259.GD25523@casper.infradead.org> References: <20200627045507.GA57675@lilong> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: C6C3518005B03 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 29, 2020 at 02:48:06PM +0000, Christopher Lameter wrote: > On Sat, 27 Jun 2020, Long Li wrote: > > Environment using the slub allocator, 1G memory in my ARM32. > > kmalloc(1024, GFP_HIGHUSER) can allocate memory normally, > > kmalloc(64*1024, GFP_HIGHUSER) will cause a memory leak, because > > alloc_pages returns highmem physical pages, but it cannot be directly > > converted into a virtual address and return NULL, the pages has not > > been released. Usually driver developers will not use the > > GFP_HIGHUSER flag to allocate memory in kmalloc, but I think this > > memory leak is not perfect, it is best to be fixed. This is the > > first time I have posted a patch, there may be something wrong. > > Highmem is not supported by the slab allocators. Please ensure that there > is a warning generated if someone attempts to do such an allocation. We > used to check for that. Sounds like we need a test somewhere that checks this behaviour. > In order to make such allocations possible one would have to create yet > another kmalloc array for high memory. Not for this case because it goes straight to kmalloc_order(). What does make this particular case impossible is that we can't kmap() a compound page. We could vmap it, but why are we bothering?