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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27369C5B549 for ; Fri, 30 May 2025 09:07:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA4BD6B0085; Fri, 30 May 2025 05:07:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B54176B0089; Fri, 30 May 2025 05:07:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6AD36B008A; Fri, 30 May 2025 05:07:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8CB666B0085 for ; Fri, 30 May 2025 05:07:17 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E4B385166 for ; Fri, 30 May 2025 09:07:17 +0000 (UTC) X-FDA: 83498995314.22.B49374E Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf04.hostedemail.com (Postfix) with ESMTP id 72EF14000D for ; Fri, 30 May 2025 09:07:15 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748596035; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SRx2SoYvhDYSzVfn4vnUrDFdUr2fTUES8URezFw6NWk=; b=ov9KcW/IGADoCoYQ9xkBhRoS42Qt7giJWXVApONYjuS5x528xwtMUhZwJPVdE+XoyzfeAv 85K4M4b9XguYnqH1XVCvr5wH4jpHTBmh9/zbct5srWSOU5Cj41lPPyfeF5KqYWqsqu5/1Z oFeQTX4bM1pV1biPRDuw1gryvVTq2DY= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; spf=pass (imf04.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748596035; a=rsa-sha256; cv=none; b=3/2CNcQH2KSyzlhFIld9aFjx283hS+p2GrCVfe6Sxl2dYJDiAhrKJ7N9BGSDehMSTMzF0A s5iCvWBtwGwzW/ZTpZmPbLNnGAJGw/7eC+uPf2/7hhQ8JvU4qH2tMEzAniNJ8jV9qiU621 q+1L7keJPtTuexyZ/VTfxcMrYGtYSqo= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2882016F2; Fri, 30 May 2025 02:06:58 -0700 (PDT) Received: from [10.57.95.14] (unknown [10.57.95.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BFAAD3F5A1; Fri, 30 May 2025 02:07:12 -0700 (PDT) Message-ID: <00999fc3-3a4a-4ee5-8021-81c73253fe7f@arm.com> Date: Fri, 30 May 2025 10:07:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] fix MADV_COLLAPSE issue if THP settings are disabled Content-Language: en-GB To: David Hildenbrand , Lorenzo Stoakes Cc: Baolin Wang , akpm@linux-foundation.org, hughd@google.com, Liam.Howlett@oracle.com, npache@redhat.com, dev.jain@arm.com, ziy@nvidia.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <05d60e72-3113-41f0-b81f-225397f06c81@arm.com> <9c920642-228b-4eb0-920a-269473ea824e@redhat.com> From: Ryan Roberts In-Reply-To: <9c920642-228b-4eb0-920a-269473ea824e@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 72EF14000D X-Stat-Signature: zikwnmaot71fcqzppo471hnyetb8sr93 X-Rspam-User: X-HE-Tag: 1748596035-895170 X-HE-Meta: U2FsdGVkX19WNkS00eQ5QwZbQErDJ7nqrW2XFd2o4xEKZToQIU2KapulOFd2OSEiCfZSH9Hx8/RFBKuK3O4SbMWzR4AeE/a1K88YIHX/y5JsNFMTZczI/othV+Cj4AfmF8O73cnR7Rl6nJiMt3id/Da0YS+OFEyM56ZHi6zZKHq8GVFHFNYylPqxGOLHgzaYEqTe/Pxb1YUfhxUfIWNAvkVHOXKzlVvvSw7g3l39FWYjlqDt2g+gbVsnnlptsttGzWc9q7XDWDhcv64wWqs5LnMailMTInQvHyb8m1cHVFO07mBMeVu13vtbP/ApNxIDsfH9E23Zy/s/NlPdOoOQ/uQFepQGeFiYuddZfsM5sKGjo6FWRhpjq57VuC7sQ470t5cQIjwXhzh+ShZIme9QFfo2ZIdx+o8DJaq7RtteUIW3vOkF6ukd0gygDaRU2YB+cNprOO5pbiYz/M1Qljir6Qg6tmBJ6vVOh51vyo9oBfh65rSg7FXECtqcrgB746Km9K9PuanNpMHwC6CL5qqPaYBaGS+8qW52HLZiYmjHg5KJETnjXD83oTGce1n0HFtZyYBFaeJYwhL/H0bWSRlR6lhIrkB0JPZnoVUX7neLpiRajrhBT6GVUwlqV9xwN+DzYeQmkeTmL7+UOYBjRcG15HCLkMsgpHOoiXhKv8ySIXNV0XPL+j/TBcHFt3z2bRRXwWVVp2qYQuLIQdnb2z30HMqbOmFLaD0Ebb5nt+pTShESD3bEeEibPWtmeczswDaGkj57sxLlZu+yqjtPx+jtIvX79P7uVlsqWU3emst0jquf7ccMZj2oDrqMBkrIYgh0tNV7wYc+rl1JoxAViFV0j0eWHDS/V3lEmpOiN/rDL2ZxOiRf1/Sh3dT1gR+0fs92EMukvVe15bzkj9T+AzW258FdxumO2qLBcPnVNvydprzzMU3gguJT76RCTAmWPyA7tWMKfli/v/2e8hFwbEh MEOWxnGN 20KL+wIUSON44/URKqzWya7Mpbi8xGnARDSpuf4vFHTnSCfU4DT6DLWGtvKivCwENT8thQlJp0ay8W1UFfSNV8/FDgiVQ5AEFanmu0cgTY6i+1SHDVNU5EbbvgidmE0uad1+nQX1gc2svuhn0npZM9rMmvBaAxKdmst+CTRAhHsv2dtPTeZbMieCEq5ZO27KzvmAkXcE0h8pJ+IBw6epxJfdbuw== 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: List-Subscribe: List-Unsubscribe: On 30/05/2025 09:52, David Hildenbrand wrote: > On 30.05.25 10:47, Lorenzo Stoakes wrote: >> On Fri, May 30, 2025 at 10:44:36AM +0200, David Hildenbrand wrote: >>> On 30.05.25 10:04, Ryan Roberts wrote: >>>> On 29/05/2025 09:23, Baolin Wang wrote: >>>>> As we discussed in the previous thread [1], the MADV_COLLAPSE will ignore >>>>> the system-wide anon/shmem THP sysfs settings, which means that even though >>>>> we have disabled the anon/shmem THP configuration, MADV_COLLAPSE will still >>>>> attempt to collapse into a anon/shmem THP. This violates the rule we have >>>>> agreed upon: never means never. This patch set will address this issue. >>>> >>>> This is a drive-by comment from me without having the previous context, but... >>>> >>>> Surely MADV_COLLAPSE *should* ignore the THP sysfs settings? It's a deliberate >>>> user-initiated, synchonous request to use huge pages for a range of memory. >>>> There is nothing *transparent* about it, it just happens to be implemented >>>> using >>>> the same logic that THP uses. >>>> >>>> I always thought this was a deliberate design decision. >>> >>> If the admin said "never", then why should a user be able to overwrite that? >>> >>> The design decision I recall is that if VM_NOHUGEPAGE is set, we'll ignore >>> that. Because that was set by the app itself (MADV_NOHUEPAGE). >>> >> >> I'm with David on this one. >> >> I think it's principal of least surprise - to me 'never' is pretty >> emphatic, and keep in mind the other choices are 'always' and...  'madvise' >> :) which explicitly is 'hey only do this if madvise tells you to'. I think it's a bit reductive to suggest that enabled=madvise means all madvise calls though. I don't think anyone would suggest MADV_DONTNEED should be ignored if enabled=never. MADV_COLLAPSE just happens to be implemented on top of the THP logic. But it's a different feature in my view. >> >> I'd be rather surprised if I hadn't set madvise and a user uses madvise to >> in some fashion override the never. >> >> I mean I think we all agree this interface is to use a technical term - >> crap - and we need something a lot more fine-grained and smart, Yes agreed there! >> but I think >> given the situation we're in we should make it at least as least surprising >> as possible. > > Yes. If you configure "never" you are supposed to suffer, consistently. > OK fair enough. Just giving my 2 cents.