Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1274025rwi; Wed, 26 Oct 2022 13:06:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM55T7uOVJ4LqA6mqK6daF0Gg/L84HFUUzVWZADyEW7+KUF2SNpstolca1xEiLyuKVyePWgk X-Received: by 2002:a17:906:730c:b0:791:997f:d65d with SMTP id di12-20020a170906730c00b00791997fd65dmr40294828ejc.18.1666814792889; Wed, 26 Oct 2022 13:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666814792; cv=none; d=google.com; s=arc-20160816; b=waKPKyca8MPwmRwPodrN01fKYZ3JulewgL6JUG5lfxhglFds+wtGNn3q4/BIaBXgDO 6QBZWZCQ09pYNsrVmPz4a8xFyKyjbIp6ifMzv64DTwg4sRygSet81E2rOuJmUqiCWUh2 NKy9y7XgXzFqzPYtD3gVkler76ykJBIjocZoUBevHXvKt3w8Den+yk6igWHJM4Jr54db 541YSXfA+ABAk6X13LpDcWJs5mDsZREEMkbN/bwyCVVhPP+EcC31una9TMgDSnOOJjqk 3Q0/Hkqzkt/vwtjlHSNXnOkD29T8Vss4JfA2J4YKwVbvupVF3HRrGP9jl1JZ1m60hHzI t4Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=SaQg4HnVfQQh2mYdE59PhhkkYlSdwKzsH9fh8OFcl80=; b=dqY0dTBvhcvfR0zN4g1epB0g6rvSqCC1p7uQmQn9pCs6be8T2EYkN3F3Phfmz8ce83 URgpscSzU12+OlkH7rrPuwRXeWsAXY3POz3WckkgfNYO6g0TgUHxWfV69jfeMKwhJGQF eMBLu20J9eKhB7lVcjYP6TdLijVVYTbNAvVfD8ibaR9BB52R+/Ct+/Bgxy4AYmkKB0wl 0xZ6jsl1Nwq+rP8sgoBpxOawTWlW/LbZSfWW3BOmlkwHSAQSBpnNDetyjqViEHwSMYeZ KoZ/40Gs8Hvs3Y2IXqiQNMIqrHeIJgBRdcSCqBXRlm5FuwgNFygrF2P+O+1y/mmbYjZp ATyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PRu7uBQe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a056402519100b004574aae3f47si3603334edd.509.2022.10.26.13.06.03; Wed, 26 Oct 2022 13:06:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PRu7uBQe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235173AbiJZTo0 (ORCPT + 99 others); Wed, 26 Oct 2022 15:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235235AbiJZTn3 (ORCPT ); Wed, 26 Oct 2022 15:43:29 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88A8FD03A6 for ; Wed, 26 Oct 2022 12:43:26 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id j15so17686603wrq.3 for ; Wed, 26 Oct 2022 12:43:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=SaQg4HnVfQQh2mYdE59PhhkkYlSdwKzsH9fh8OFcl80=; b=PRu7uBQeiTNcFGjkqeZ74eaq3R/EF+NH31oAX8cDpG/wYGxfFmt9Z5x0qMz5ioIfa4 153FPA33eWFb2S/npkwFrQjXvj7WXncaKXnXwaCG2yMjUflNCYdQ7dMFPmPWER9/lRH7 O9JDY+aLcohMLijh09Yj1dqdZ5k7J7tQoAJLBUi7QncRx0IwsyQnovUOvmIAK6HzOVl/ 2RYybC1Es4lI7h71AV+gZvdKPv6D+2l7aVV9FdfSaq3vHAESJPh/nEuD1ZE0wQAdrni8 okhtlFkvuD/iRcxg5R7JhVqA5+zLJ6BTe74rMPrEv9vkXeopiM6wgS04rGqIwH1OxVEj orgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SaQg4HnVfQQh2mYdE59PhhkkYlSdwKzsH9fh8OFcl80=; b=TCgKzPeVC8kEsN/7ZM4E41P1GokQqkvZKOpNayCTRJQUwnoIsgZ6pXmmejWvgfxnaI /MyxRyCNYf3HgTO6sfxjYBsLOg7b6G6hn6Nk6Rx6ah6U/WTr7PRj1L6EYcLYYlta9I7z NPlZcF7jRoI0JWUk/EgbCWVJpOQkbx6NE6aFyajjl0QS0OqXBeirzR0KctOE4FRbaQaw JMiHHJ00lQB9BXE06eXfLypMTxCudL0T0Od68JQl1c9qPx17f3s3tcnIToRNRaxw3SRH 5TPHur2SWgGqWaqCib5plnUilSG7dWp4Y5uIWHQxF5fjlwGsU3Ek9+8OCq2yietBMdte 2epA== X-Gm-Message-State: ACrzQf1ut+EBhLeGDrtWZp1xnsNRBbxAKmLpzyojAiRzWrlBoZf9qvjv 58H9uBFysyVaYZDy4WmW68w= X-Received: by 2002:a5d:4b90:0:b0:236:702f:2093 with SMTP id b16-20020a5d4b90000000b00236702f2093mr12611103wrt.577.1666813404745; Wed, 26 Oct 2022 12:43:24 -0700 (PDT) Received: from smtpclient.apple (bzq-84-110-50-27.cablep.bezeqint.net. [84.110.50.27]) by smtp.gmail.com with ESMTPSA id o1-20020a05600c338100b003a3170a7af9sm2601374wmp.4.2022.10.26.12.43.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Oct 2022 12:43:23 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH 01/13] mm: Update ptep_get_lockless()s comment From: Nadav Amit In-Reply-To: Date: Wed, 26 Oct 2022 22:43:21 +0300 Cc: Jann Horn , John Hubbard , X86 ML , Matthew Wilcox , Linus Torvalds , Andrew Morton , kernel list , Linux-MM , Andrea Arcangeli , "Kirill A . Shutemov" , jroedel@suse.de, ubizjak@gmail.com Content-Transfer-Encoding: quoted-printable Message-Id: References: <20221022111403.531902164@infradead.org> <20221022114424.515572025@infradead.org> <2c800ed1-d17a-def4-39e1-09281ee78d05@nvidia.com> To: Peter Zijlstra X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Oct 25, 2022, at 6:06 PM, Peter Zijlstra = wrote: > if (!force_flush && !tlb->fullmm && details && > + details->zap_flags & ZAP_FLAG_FORCE_FLUSH) > + force_flush =3D 1; Isn=E2=80=99t it too big of a hammer? At the same time, the whole reasoning about TLB flushes is not getting = any simpler. We had cases in which MADV_DONTNEED and another concurrent operation that effectively zapped PTEs (e.g., another MADV_DONTNEED) = caused the zap_pte_range() to skip entries since pte_none() was true. To = resolve these cases we relied on tlb_finish_mmu() to flush the range when needed (i.e., flush the whole range when mm_tlb_flush_nested()). Now, I do not have a specific broken scenario in mind following this = change, but it is all sounds to me a bit dangerous and at same time can = potentially introduce new overheads. One alternative may be using mm_tlb_flush_pending() when setting a new = PTE to check for pending flushes and flushing the TLB if that is the case. = This is somewhat similar to what ptep_clear_flush() does. Anyhow, I guess = this might induce some overheads. As noted before, it is possible to track pending TLB flushes in VMA/page-table granularity, with different = tradeoffs of overheads.