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 CBB95C433EF for ; Tue, 19 Apr 2022 20:03:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DC176B0072; Tue, 19 Apr 2022 16:03:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 48BF76B0073; Tue, 19 Apr 2022 16:03:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32CC86B0074; Tue, 19 Apr 2022 16:03:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 1FA226B0072 for ; Tue, 19 Apr 2022 16:03:00 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id EA5D582596 for ; Tue, 19 Apr 2022 20:02:59 +0000 (UTC) X-FDA: 79374702078.06.E95296E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id CA62E4000A for ; Tue, 19 Apr 2022 20:02:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650398579; h=from:from: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=9izpskydEi+3ErUMuIEWjaea6saspqtG1FCurICTcOE=; b=hq65I7niMaCwGamCLVL30JGs9t6KBwzMBbHZVZb4+eJhA0bWZjd/uZxfaUxIywA8Z42VzI FdgvSb/t9zPVhr+ZtgluWxN6v5FU2C8QQ/Pmv5yL2y+iKuAy2yl92g7YS4LwvsLn4LtLwz pAkfeFF6G9e0szmu99D4F6AdNXSTyfU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-531-7fhrsDqkMxKQ164ZrxjoAQ-1; Tue, 19 Apr 2022 16:02:57 -0400 X-MC-Unique: 7fhrsDqkMxKQ164ZrxjoAQ-1 Received: by mail-wm1-f70.google.com with SMTP id d13-20020a05600c3acd00b0038ff865c043so1831271wms.3 for ; Tue, 19 Apr 2022 13:02:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=9izpskydEi+3ErUMuIEWjaea6saspqtG1FCurICTcOE=; b=hM9tymrAl1Q4LiyCKHIufgQ7dSUbIm0TnzkP1+dwHzskB8oNqBAaTwpwqTf4D/ubTZ lTwWgTfFd8GSm8Vu9+ERY97FfSn+Hf5eGLrYauV7wBaqavdn3/PtY0ooZgS7Lx/w9J/B ccfnsOmuQFFOcgTGZTGi/HGWmRdDncSNCR6WgVRdXshuJ+9hPwyuPGvTg1CAUSLz61Lr soWIQ7Gwu9MRRuCftQ1cbO9NTL2JksfneK48/TBs2BGmVjrVl1DF+F+3ziIR6AdpbqA/ SUwclmAvsXPDbwVh7H9yymQJh3BLDBkV1QgSdL0AemEMxG8Wf9lGcirs9eSqV1fhNQSl uI4Q== X-Gm-Message-State: AOAM532eEe6cjQNnPdOlKcdTlEm1XehtTSQEHY5NeSN7qwq77qOEEQe9 Xle9amH3hCfyusOcha7nCxay76B+W7171hivHO8CBMw9xfZVSVBN54ORSfWGfK3371rMZjqYaWX J2mf6b5evemc= X-Received: by 2002:a5d:595f:0:b0:20a:88cf:c047 with SMTP id e31-20020a5d595f000000b0020a88cfc047mr11969843wri.63.1650398576730; Tue, 19 Apr 2022 13:02:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxN2t4bQwos01FpTILcfzku9JisgQwzBZYgWdlnZJ6km3z8zga01g1y9BVuAWNsKQWtomxWuA== X-Received: by 2002:a5d:595f:0:b0:20a:88cf:c047 with SMTP id e31-20020a5d595f000000b0020a88cfc047mr11969813wri.63.1650398576341; Tue, 19 Apr 2022 13:02:56 -0700 (PDT) Received: from ?IPV6:2003:cb:c704:5d00:d8c2:fbf6:a608:957a? (p200300cbc7045d00d8c2fbf6a608957a.dip0.t-ipconnect.de. [2003:cb:c704:5d00:d8c2:fbf6:a608:957a]) by smtp.gmail.com with ESMTPSA id s7-20020a5d4247000000b00207a281b2f4sm12539593wrr.110.2022.04.19.13.02.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Apr 2022 13:02:55 -0700 (PDT) Message-ID: <0cb08671-52b2-608a-74f1-eb6fdce5f100@redhat.com> Date: Tue, 19 Apr 2022 22:02:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 To: Zach O'Keefe Cc: Peter Xu , Alex Shi , David Rientjes , Matthew Wilcox , Michal Hocko , Pasha Tatashin , SeongJae Park , Song Liu , Vlastimil Babka , Yang Shi , Zi Yan , linux-mm@kvack.org, Andrea Arcangeli , Andrew Morton , Arnd Bergmann , Axel Rasmussen , Chris Kennelly , Chris Zankel , Helge Deller , Hugh Dickins , Ivan Kokshaysky , "James E.J. Bottomley" , Jens Axboe , "Kirill A. Shutemov" , Matt Turner , Max Filippov , Miaohe Lin , Minchan Kim , Patrick Xia , Pavel Begunkov , Thomas Bogendoerfer References: <20220414180612.3844426-1-zokeefe@google.com> <8d8da2fb-aed9-96d0-47ed-94806e190250@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v2 00/12] mm: userspace hugepage collapse In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CA62E4000A X-Stat-Signature: su5u57c4w151stca4x3oq9ypzpd87d5i Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hq65I7ni; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf12.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1650398577-789522 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: >> E.g., have with a very sparse memory layout, we don't want to waste >> memory by allocating memory where we actually have no page populated yet >> -- could be user space won't reuse that memory in the foreseeable >> future. With too many swap entries, we don't want to trigger an >> eventually unnecessary overhead of swapping in entries if user space >> won't access them in the foreseeable future. Something similar applies >> to max_ptes_shared, where one might just end up wasting a lot of memory >> eventually in some applications. >> >> So IMHO, with MADV_COLLAPSE we should ignore/disable any heuristics that >> try figuring out what user space might be doing. We know exactly what >> user space asks for -- and that can be documented properly. >> Just a thought, if we ever want to implement khugepaged in user space, it could theoretically obtain similar information using e.g., the pagemap. It wouldn't be race-free, but the question is if it would matter. I consider the primary use case of giving an application more precise control over actual THP placement. > > Sounds good to me. Would you also be in favor of decoupling allocation > semantics from khugepaged? I.e. we'll pick some default gfp flags and > not depend on /sys/kernel/mm/transparent_hugepage/khugepaged/defrag? Good question. It's not really a heuristic like that other stuff. Easy answer: we're not dealing with khugepaged, so anything in /sys/kernel/mm/transparent_hugepage/khugepaged/ shouldn't apply? Sure, we could have a separate toggles for MADV_COLLAPSE. Maybe we simply want a dedicated syscall where we can specify additional options ... but maybe that simply over-complicates the problem. -- Thanks, David / dhildenb