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 50C65C43334 for ; Mon, 27 Jun 2022 13:27:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D068D8E0002; Mon, 27 Jun 2022 09:27:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CB54E8E0001; Mon, 27 Jun 2022 09:27:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B564B8E0002; Mon, 27 Jun 2022 09:27:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A49888E0001 for ; Mon, 27 Jun 2022 09:27:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 7833D120777 for ; Mon, 27 Jun 2022 13:27:56 +0000 (UTC) X-FDA: 79624093752.04.D68F75B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 0DA44A001A for ; Mon, 27 Jun 2022 13:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656336473; 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=N/0G7NV5hKwjEdMeLOZY1YwHyBpHLDi7vGArF0HHE7g=; b=Xg3NnaXhCIpMrYCY5fxUu/lZuZ3WHo8PE3bQ1pxDaIzvLK7ZNjxJrvcOdxr37Esq/fFMtF ag0d/kOsVfuhYcZJmCMsBvTeqi8BW3CBDtrmy43Ybv8a/GGToxqb5x2hd4xBq7ft0uEDZu dgGBePqGZ48zHKctn1gmgGDOjqI1Rss= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-Fen8d8rEMROuIKaJFjcFtQ-1; Mon, 27 Jun 2022 09:27:52 -0400 X-MC-Unique: Fen8d8rEMROuIKaJFjcFtQ-1 Received: by mail-wr1-f69.google.com with SMTP id z11-20020adfc00b000000b0021a3ab8ec82so1197091wre.23 for ; Mon, 27 Jun 2022 06:27:51 -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=N/0G7NV5hKwjEdMeLOZY1YwHyBpHLDi7vGArF0HHE7g=; b=13IRrOP8qh0bQwKSI8vA00SLCyZjeiDeh8/pl08Ayxjh7UYbYhV1Gu2BPAm15NiJxi q7bqbebGM+kWRjGDkKY63vebNMx2INiwhqDNoEh7DpcIm9u150b4R/GS6T9yL28QBUQN QaSzn3YO+3IYeDhTk6PjcyvLkXGZjI1VfocH3xFtRJjUKkmCLw584X/KcvFK2GFGiVL2 /8vIUQdGfBD+TduTwAP7h8uNKigvfpMdklwEk8eyvhNjzBRxJSB0pwYas7bAlR/6m5WZ xsvlcIvO97GfHwEdLQ2fNo5o0t7tMAFbEvfILNdGjkBwqPQWrftl3y3xWksVUzHVS9TC Nq5A== X-Gm-Message-State: AJIora8v38rQPh3RiOz0OaLBpXF3Huyltu7LzbJ4TXkeQv3LU0kDT8ws d+7JMuwK5ZUpqDLUgWDzKoUFrxizW8OgfTuAuPVWKLVNlYA7fBxDG9FVVrm+Vzz7UNWcUhn9pN9 gSUJpzFUD22E= X-Received: by 2002:a05:600c:4f56:b0:39c:6fb7:ee3d with SMTP id m22-20020a05600c4f5600b0039c6fb7ee3dmr20450398wmq.36.1656336470879; Mon, 27 Jun 2022 06:27:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tcuwXBmgfAwbnhu0lVmbjgoHpyVS8zZRgvgM73w31jdCqD9llkvUXqh1KCcGkI6uF9DIlEAg== X-Received: by 2002:a05:600c:4f56:b0:39c:6fb7:ee3d with SMTP id m22-20020a05600c4f5600b0039c6fb7ee3dmr20450372wmq.36.1656336470546; Mon, 27 Jun 2022 06:27:50 -0700 (PDT) Received: from ?IPV6:2003:cb:c708:d100:dd9:b2f7:f126:11c2? (p200300cbc708d1000dd9b2f7f12611c2.dip0.t-ipconnect.de. [2003:cb:c708:d100:dd9:b2f7:f126:11c2]) by smtp.gmail.com with ESMTPSA id 3-20020a05600c230300b003973c54bd69sm17455865wmo.1.2022.06.27.06.27.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jun 2022 06:27:50 -0700 (PDT) Message-ID: Date: Mon, 27 Jun 2022 15:27:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 To: Peter Xu , Nadav Amit Cc: Linux MM , Mike Kravetz , Hugh Dickins , Andrew Morton , Axel Rasmussen , Mike Rapoport References: <20220622185038.71740-3-namit@vmware.com> <18BCC23E-B344-41A8-926D-A49D768485AF@vmware.com> <6EF7D3B4-CF17-407B-A50F-B14D595E99A5@vmware.com> <07B65135-CA6D-4839-BAC0-6D63A94F50C2@vmware.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v1 2/5] userfaultfd: introduce access-likely mode for common operations 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 ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xg3NnaXh; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf15.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656336474; a=rsa-sha256; cv=none; b=CfXEnPIEnkQInSYW/aY+mTlDjfKSomX4spB8DdspDig3c6wCQkjReq4XOz67t/E2+DX/4S 0cZ5a3LoaWYur2gorFMvJE1fWGm0iNjCyS8ddbUqRwBZfjl0VntBpCT+pacSrUA8CFNiHM QK345FJ3pWcqXYqkBZ+7YIXAlrhsdFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656336474; 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:dkim-signature; bh=N/0G7NV5hKwjEdMeLOZY1YwHyBpHLDi7vGArF0HHE7g=; b=1Z5Zpm+YoQXsy1T7ruYtv0KNLki77Rlows4/Fqj9Qss82Ui3HjmNygcyW2IN3iJFqNiaKk wDUjA9simvlq1ubbtTsYgBYunTzL75RwJYbuDEvLVUNlRO6VpwicBQLaC4V+h/J6e63spX SzpI4PcmG8DNg02HtlKBpwgnG+xXIrg= X-Stat-Signature: fkpsx1yqh9f97q5fw6awyb85cy9csx5o X-Rspamd-Server: rspam08 X-Rspam-User: X-Rspamd-Queue-Id: 0DA44A001A Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Xg3NnaXh; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf15.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: 1656336473-58657 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: > Fundamentally, access bit has more meaningful context (0 means cold, 1 > means hot), for dirty it's really more a perf thing to me (when clear, > it'll take extra cycles to set it when memory write happens to it; being > clear _may_ help only for the tlb flush example you mentioned but I'm not > fully convinced that's correct). > > Maybe with the to be proposed RFC patch for tlb flush we can know whether > that should be something we can rely on. It'll add more dependency on this > work which I'm sorry to say. It's just that IMHO we should think carefully > for the write-hint because this is a solid new uABI we're talking about. > > The other option is we can introduce the access hint first and think more > on the dirty one (we can always add it when proper). What do you think? > Also, David please chim in anytime if I missed the whole point when you > proposed the idea. Well, if we have an ABI that places pages without further information *why* we're doing that makes us having to guess what to do or what not to do, and I think the zeropage placement is a prime example for that. Personally, I think communicating the intention in forms of hints is something that doesn't leak implementation details into an ABI. So "no planned access" vs. "read_likely" vs. "write_likely" conceptually makes sense to me. As I raised previously, *if* we want to let the user affect the dirty bit setting (1) is then a pure implementation detail. Or whatever else we might want to do. But I also want to raise awareness that architectures that don't have a hw-set dirty bit have to use page faults to mimic dirty tracking. IIRC, s390x is a prime example for that: pte_mkclean() sets the WP bit and marks the page dirty from the write fault. So it's even more expensive than on other architectures. -- Thanks, David / dhildenb