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 X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F224C433DF for ; Thu, 13 Aug 2020 19:03:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F104E206B2 for ; Thu, 13 Aug 2020 19:03:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="D+KqO8Dx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F104E206B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5EB156B0025; Thu, 13 Aug 2020 15:03:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 59B706B0026; Thu, 13 Aug 2020 15:03:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B1146B0027; Thu, 13 Aug 2020 15:03:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 354956B0025 for ; Thu, 13 Aug 2020 15:03:03 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D5F3A181AEF23 for ; Thu, 13 Aug 2020 19:03:02 +0000 (UTC) X-FDA: 77146467804.07.book09_411606926ff6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 9FD7E1803F9B2 for ; Thu, 13 Aug 2020 19:03:02 +0000 (UTC) X-HE-Tag: book09_411606926ff6 X-Filterd-Recvd-Size: 4980 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 13 Aug 2020 19:03:02 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id d2so3612710lfj.1 for ; Thu, 13 Aug 2020 12:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=exAlskjzIFOE1QMe0saylZOMoEP4iKWyM0PCmNmV2iE=; b=D+KqO8DxYbapI0GwZR2nNjGv6dp+d+eVYzQHwg5OMjCbe3Q6SGne/SURb84sC+W4Bf WlFabSyY/QeiyaXTbQEFykeACFf5RZkc3ed28jFSDCVYw1jr/QDpijkI6yyaYHoDWcFI MCFoMmJ6MPdGoGJ2OI3Xt9c/mIbtsjp3OvXv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=exAlskjzIFOE1QMe0saylZOMoEP4iKWyM0PCmNmV2iE=; b=mlKWigDHVip/6haRj7YsXSOOIz8otPsAWI0ky7Xgn6NtphvMila0Dujvgdtbh9wth9 7sqftyHwfz05zfEZPel9Tul+y3XmvZPUvDezRpWEGVe19XIAzpjpuwXEXSG3r2umAnLR Y6igehyExNOAaLr0EjHWFsyo9G5JCaW/6s5lnL2aujmXUgZG0wJDjOwndp2vKBfFCya4 FtPg4bTAGOZAORuWYxB5oXjBJZpwa4iq2WTb6uG+1S4EcXbP4X9TqhkcYYxlwxbGJ2q3 gnDKkd6ULAN9rt6yN+hesOjqm3dnODhoSX4OO1djVu+H/z99IgZrwe8pg2HAt54XP5t3 S/Rw== X-Gm-Message-State: AOAM5326um4Dy7iZlTrECOudc5m8iAhvjE4XNRvOlAtLg1pK0pnzEJxC GTXvODYzdvSpww8VmEB7qqbKhUf9E2o= X-Google-Smtp-Source: ABdhPJw1N6DuTALTNMofQSfFoYikbFWck0f5aJ3+c70vrx86vhudG+NW2+ZwE+rUvEwj6NMS9AeKgA== X-Received: by 2002:a19:a07:: with SMTP id 7mr1296119lfk.65.1597345379598; Thu, 13 Aug 2020 12:02:59 -0700 (PDT) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com. [209.85.208.182]) by smtp.gmail.com with ESMTPSA id c17sm1367615lfr.23.2020.08.13.12.02.58 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Aug 2020 12:02:58 -0700 (PDT) Received: by mail-lj1-f182.google.com with SMTP id z14so7390114ljm.1 for ; Thu, 13 Aug 2020 12:02:58 -0700 (PDT) X-Received: by 2002:a2e:9a11:: with SMTP id o17mr2566294lji.314.1597345377681; Thu, 13 Aug 2020 12:02:57 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Thu, 13 Aug 2020 12:02:41 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] dma-debug: fix debug_dma_assert_idle(), use rcu_read_lock() To: Hugh Dickins Cc: Christoph Hellwig , Andrew Morton , Dan Williams , Eric Dumazet , iommu , Linux Kernel Mailing List , Linux-MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 9FD7E1803F9B2 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: On Wed, Aug 12, 2020 at 8:17 PM Hugh Dickins wrote: > > Since commit 2a9127fcf229 ("mm: rewrite wait_on_page_bit_common() logic") > improved unlock_page(), it has become more noticeable how cow_user_page() > in a kernel with CONFIG_DMA_API_DEBUG=y can create and suffer from heavy > contention on DMA debug's radix_lock in debug_dma_assert_idle(). Ooh. Yeah, that's ridiculously expensive, and serializes things for no good reason. Your patch looks obviously correct to me (Christoph?), but it also makes me go "why are we doing this in the first place"? Because it looks to me like (a) the debug check is wrong (b) this is left-over from early debugging In particular, I don't see why we couldn't do a COW on a page that is under writeback at the same time. We're not changing the page that is doing DMA. In fact, the whole "COW with DMA" makes me feel like the real bug may have been due that whole "ambiguous COW" thing, which was fixed in 17839856fd58 ("gup: document and work around "COW can break either way" issue") That debug thing goes back almost 7 years, and I don't think it has caught anything in those seven years, but I could be wrong. The commit that adds it does talk about a bug, but that code was removed entirely eventually. And google shows no hits for debug_dma_assert_idle() since - until your email. So my gut feel is that we should remove the check entirely, although your patch does seem like a big improvement. Christoph? (And Dan too, of course, in case he happens to be relaxing in front of the computer away from a newborn baby ;) Linus