Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3006298ybt; Mon, 29 Jun 2020 12:43:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuB7YNQjzvhpLhNiLJkU7Y9R7Y7useanA7v4o3YIS3L3ZaEJAhHn09Yawh7LtxpSa4ZCHI X-Received: by 2002:a05:6402:1217:: with SMTP id c23mr19296894edw.270.1593459796361; Mon, 29 Jun 2020 12:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593459796; cv=none; d=google.com; s=arc-20160816; b=M0frOJX2JO4DzQv0gD5Yev4NfiSLSW6J7vOAHf9lp97Ry20ZNjye5MSLn13u/2oxsS I+iMP3qcCPl/tY+Y7UFeig3ijIesDwQZZ14mvAe8nTekeEgtca2lgFBcKU3BGisXnSZY ezIMrZZ5NRTtMfmWWr+CfBlHiY/5QemFLze9Oi5Bc8wI1DqcNIolonfirmQpxUAkglrl W5s2vVPdM1MY1wh6ErIpJXwFKYl1E9IRI8S2fvoAFVtQcLiTpjmYP8NfIvvZCTx4DMZ5 mkHfM7Kp+Y000wg74+Wv7dS7iP9mcuYL44SUtbpjXCarB5Tig9308Cba714PMLCAAVlI UsQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2qpcCa8MJg4RGNN56Q/d+ivYnFyOiwqo1KyRA7BzBV0=; b=tSDWazk7J9A01uSBmW67cE0JZiLAnqqXsUrnVroBe7t5Aq2WsynPfuRR6pevVvNxrj BLH2rUGLIqwJzcb552iULWUIiBNondDagthbjHPG9iBc/WcmQd1pf/Vql9GWGynxZXpL 7DnjuqqKUhs3nArqQ9kSiLI839nbxWCDcmKX8vDECe5X9QA2sIoIBS5uSU5PjNA6m3v6 2JiZKpi5EhdkreZhhNwU3e2OcN97ztVk7EPgK7AEtimr5kXH9VmrOp+2h8FP1DPlJ0OI xejSc0x8wJDjgmW9uv4Wa5wGNGlGG9b90ehSbbMwN0Fiiqv4lxv9wgFq7GRoJ/NhsVFF glmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=vgyw8ooe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si276619edw.577.2020.06.29.12.42.53; Mon, 29 Jun 2020 12:43:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=vgyw8ooe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388013AbgF2Tmt (ORCPT + 99 others); Mon, 29 Jun 2020 15:42:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387982AbgF2Tmo (ORCPT ); Mon, 29 Jun 2020 15:42:44 -0400 Received: from casper.infradead.org (unknown [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC0DFC02F01C for ; Mon, 29 Jun 2020 07:53:25 -0700 (PDT) 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: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?