Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3003037ybt; Mon, 29 Jun 2020 12:37:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ/rRXHg3ZUOZKerpQp9xyN3RM8Mx1+O7tpOsv8ZD8VgV5RmppvqGuotwsy42MWpHu9UF+ X-Received: by 2002:a50:b065:: with SMTP id i92mr20422014edd.112.1593459448262; Mon, 29 Jun 2020 12:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593459448; cv=none; d=google.com; s=arc-20160816; b=QXqiZSeiyYXkn0AAY0MUIYJW5/IMdJz03yv2sMm3ZafIB1fVSEnVd3qmoXEtC9Yn9b t8jYQZmr/x7qgSB/vMjcPXdfMeg7WVvjEv6NaSem6EAaET4my53noUUxLp9vmcHETbYb 0CEQLOk6sN+tZbYEFrXcXqGrfw45UT38KmXjWMNcML6VvpoGQbfP1+ROAzOk9hrVKYV1 t6neKSxmWBAHWFQ7KTRlTTMG+/Rocs0k/i+i+QqCyLQz6EkXZ7JWvFNLg+cA06aVb+Vk S8kAhQ19j1Qn0i9KCOmqe2Lcf8mwAyDTSYOvlmkcCKqiLPYSt2XIr+3Fum+5w0Q/JSSV Q/eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=Ea3oCUdxplfEiTGFlvtjgBTpP6WgeYu9GEA4C5QFPz8=; b=nCLG6mCKZRd3q2DJ9FejMwT0RuKYp1rTL/1SPQBpsh7sNIfSPQK586gnWWrhASmPVt MoPUaCGZwVdefVHPlp0T5QnhtJf1eHMI+KEsN+Htci0U7PKWuoezdvOc4PEuTdGPMKJj 7UFV/7/0ebAQRl7fVzDtyUaUl6IrEsCP3D2crONgf0828oBN7OkUD57HUQfPSGJ3lF9t afkpGEgY1wXL1jLVNUg6t5N6+qsLCeYqEO75EK/rgSWY+Ywalj3u9z1Hk9skx9u3KHUG G14tG3gBZFE7lfwAlQGs7VseZxuZ9WGvq1DuPqcn5c0CPF/aW6o+KzHfdrG+3jiJe+RG rAGw== ARC-Authentication-Results: i=1; mx.google.com; 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 d18si300534edy.194.2020.06.29.12.37.05; Mon, 29 Jun 2020 12:37:28 -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; 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 S1733286AbgF2Tg7 (ORCPT + 99 others); Mon, 29 Jun 2020 15:36:59 -0400 Received: from gentwo.org ([3.19.106.255]:55698 "EHLO gentwo.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733210AbgF2Tgx (ORCPT ); Mon, 29 Jun 2020 15:36:53 -0400 Received: by gentwo.org (Postfix, from userid 1002) id 51E033F03B; Mon, 29 Jun 2020 14:48:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 4F9923EA72; Mon, 29 Jun 2020 14:48:06 +0000 (UTC) Date: Mon, 29 Jun 2020 14:48:06 +0000 (UTC) From: Christopher Lameter X-X-Sender: cl@www.lameter.com To: Long Li cc: 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 In-Reply-To: <20200627045507.GA57675@lilong> Message-ID: References: <20200627045507.GA57675@lilong> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. In order to make such allocations possible one would have to create yet another kmalloc array for high memory.