From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=91.218.175.75 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796234667; b=bHhSkq7dm0vQ14oVxasXtaSUAjSodN3fXwM6kiqEbqrejGDYg8pMdFVw66vNtdZKiBsL /gUblN9r56t+wDImp+0C67yk01gzOpnAB9kvjlgTMRc8XYwnoR6ASKWlqqtk1yZp3syIL 3nYtsGqEoEalDfGzRn/hJIdGgU9+dbZSCf0+sLS1jL4b06rcKoU/PIQo7AJP9lORPb/oV fcsdz47ee7LC8dLzJCFSR21lRCVUxC8eoQspqMwaK0ldiYY7+KdBGHqpyppMOmV0NdsAL XLpAVvDOJhRY0aX4XFJwzLCNkxZdFcRI2ro0/LAaxVuHuRGhOLP2ad+aStourbU35CA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234667; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=XYueRIT3TIVnADbfsUlUCmPTa29ZEnCW9StP2LMtbz8=; b=iX4tyJcFMiNte0y2Yb3IS7NCN2YDlBiJIj2WpbaH+3JnA77DTFxz5iym3iw9M6tsVXsr xYJFZfu3PgMoWVqrUsowXheIAPL14/Y7YPPkBm9dYPR25HvnFgWCmgDL/6tCzLfCI8AIS ObU8zr5yScIBRb9sgSoopOC753r7F+tfRjwczIU6LWgOwxls6Knz2qz1j5sMAZxh+NJgq /aK4emBISMF5dPu9WMCw0P/jELQc3MQ9txwyxYIGNjalgXL8ugdO5Fi7BvWb4LtGbJ0du XIeP93lZ7Uh43Eo3mIU2KQrkn3WcYv5Nn4yhZKXIvj/eNCUtxzqS1nmYdIgQD/GbBww== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=wKniuWJr; arc=none smtp.remote-ip=91.218.175.75 Received: from mta0.migadu.com (out-75.mta0.migadu.com [91.218.175.75]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 401A5606A330 for ; Wed, 2 Dec 2026 18:04:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 401A5606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=wKniuWJr X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=XYueRIT3TIVnADbfsUlUCmPTa29ZEnCW9StP2LMtbz8=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796234665; v=1; x=1796839465; b=wKniuWJrorelA2Vpk5SH+/vxvbJI0z5AFNiQpkC2sQnzCrZeNd1jW8NAolfJd/3Bb+w1YTqc B/1wZG2goUw7l7082tGvzxbf80sMBfvXuk0X1OVVcf0w3uXyHrI/pOUwNfrd3fI5XCs3WxVlYyY q3wCOkTNfFAV7B7yJy2KQQmY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 2346007e821d0d4f; Wed, 02 Dec 2026 18:04:25 +0000 X-Mizu-Trace-ID: 2346007e821d0d4f X-Migadu-Flow: FLOW_OUT Date: Wed, 2 Dec 2026 10:04:20 -0800 From: Shakeel Butt To: Alexandre Ghiti Cc: Andrew Morton , David Hildenbrand , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , Kiryl Shutsemau , Vlastimil Babka , Mike Rapoport , Michal Hocko , Lorenzo Stoakes , Suren Baghdasaryan , Pedro Falcato , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] mm: madvise: don't split a PMD on partial THP MADV_DONTNEED Message-ID: References: <20261202102818.1317130-1-alex@ghiti.fr> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261202102818.1317130-1-alex@ghiti.fr> On Wed, Dec 02, 2026 at 11:28:10AM +0100, Alexandre Ghiti wrote: > MADV_DONTNEED on a range that covers only part of a PMD-mapped THP splits > the PMD and zaps the PTEs of the range. The THP itself is not freed: it > stays allocated and charged as a whole, now partially mapped, until the > deferred split shrinker splits it under memory pressure. Until then the > process has lost the PMD mapping, and the TLB reach that comes with it, for > no memory benefit. Isn't the actual problem higher and unexpected memory usage? Application or the malloc implementations do madvise(MADV_DONTNEED) to release memory and expect at least decrease in RSS. Why not fix the cgroup memory usage as well by synchronously break the THP as well. See https://lore.kernel.org/all/20211120201230.920082-1-shakeelb@google.com/