Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1329487pxj; Fri, 4 Jun 2021 11:27:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeG6pp7yMXGgL0qr/HsKwDgBp1lkR6xcMk62BCEB8BJNe53otm6vsDDAwev4eAd0IyU7bF X-Received: by 2002:a05:6402:1d0f:: with SMTP id dg15mr3486537edb.137.1622831274224; Fri, 04 Jun 2021 11:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622831274; cv=none; d=google.com; s=arc-20160816; b=pCSbLYr57t2iadb8OnQ9rW276sZ5cuh7l3cyVWSb0YvjbL1OvaG/7Jm62D5KVwvwHo M7Z9d5wuHfI7BpRRaTkTBY3Wnx4YygIOIXrPsS/a/nCFhMZgUem5/EB7pO2bAX4VBK/7 25CR/AZOXTK68SN+4T1kBVxMtazsZK74wEtYwlNfsQVFQ9aWRnUtNVzZiRKDHUnzXDwp aohHr6qoUOXaEMNcgT1f28kQ62ajJgQZ4/D7Qt0pkCOMNhMDOTVe5dH8GJfKYZNQOrL2 b78kqpn77ivMwnAFvfG6YY62beXeKq7zHbxAwVby0OqF8gFsQ4q15AeRAurtEqziXY10 oXAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8NkZLuODRGewH4zgC3asg1j+OkGGx+7ZEADeUCWN74M=; b=ZtGkIWeRysa4wSUXyBxRUjhYl01G8uulsaAIXABSyTOLezg1N/GSs3HxWMjC9rIvX0 BFZ0xkC+8oUSODOUsjbKYVBtfMLUTeAuM/sTQhD3vYEgcudRUPKvr+psBi2lWbHq7+IZ w4jXRcwFDO1qa11XfDNUf13WQqjZfBRYncEROkZN98BgKL1c9LaN7GSw0ufnnJe2HmXc 7pskz6WUkE4qnnwZBMlUyTUusCmLlR/YKGOFHa8i+UpDl4Oi+SD7anUBCn+wLrsVweKh AO5JJDvkRQARVNJoC+z3M5oD0sMW0R5q48tuETN7ZRNEDZkPvDNBUO/91uwuyLoFN6kl +VLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AZOMP7Rw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv8si5300513ejb.377.2021.06.04.11.27.31; Fri, 04 Jun 2021 11:27:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AZOMP7Rw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230022AbhFDS0z (ORCPT + 99 others); Fri, 4 Jun 2021 14:26:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbhFDS0y (ORCPT ); Fri, 4 Jun 2021 14:26:54 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D815C061766 for ; Fri, 4 Jun 2021 11:24:53 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id i13so12208027edb.9 for ; Fri, 04 Jun 2021 11:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8NkZLuODRGewH4zgC3asg1j+OkGGx+7ZEADeUCWN74M=; b=AZOMP7RwTJv+l9AGvBTpG43OcDsnnTvgcZRvwckXkRIPNds68iR+iR6l1vRACYm0eF znXZdiMm+96xHm4rcPmcza3bIy6sTFZiupGZPbw6MbkkSJD+vmsDjjq1KkdrTno4J/F8 gSlQ7cA7SyyHwaiBKj2t60vTm4puwPSkfWgGZAeCa0Ew95TCCj7jcwCpe5vyTPKJUhoT +QOHqzem+HNdUt2Ywtwp07U0tswsfMNeZWdtQlYHWxIsk+PTFYmKxZ3H21a5UD6udAxL gnnDD7SOfX5MWhpqkFMK/QonB3sZCo5E1AaUyCUlAG2pF4TqPXYZY7p9m86yy0+IAgSO mYDA== 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=8NkZLuODRGewH4zgC3asg1j+OkGGx+7ZEADeUCWN74M=; b=gJTcPZ+CkSXCD0Pr4sLUE33dBTEykHn01PhE7teJSwu2nMUGMPGtVZogoYeuHYk2TP Hpe8I6wvJR93wyFjfpUcy1efEpSi6QtKiPsdHUIz94+qZq/soFGNK1ESJatlPPIuJRT/ UjtCL1MFSURNip8GRaUN/Ij48kYQSK/3S7MWme4tKvRODfiMxc2PQs0RextHkXhEySEu Q+RqjQFyemA11JbUstVFGLk867ddfwm8DF/sH7jwMPjBrqODtkYHiVjvnUSmVvcJnOiQ B/b8Q6uu/L2nRYM6xb8XsgXSk5DvdK08QGnZtDxaAGJL8nJDkcpjZwR0k9EuC/SvEIHC zAgw== X-Gm-Message-State: AOAM530DnDNgDfb3HGWvlPHH6jwp2BbbufZo6lkbmm68kgF9FdUCgQJH W2Oa/BXHHSdgV2TlTcSm4iaj0Qz2JPV7Pvfbclw= X-Received: by 2002:aa7:d5c6:: with SMTP id d6mr6020346eds.290.1622831091631; Fri, 04 Jun 2021 11:24:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yang Shi Date: Fri, 4 Jun 2021 11:24:38 -0700 Message-ID: Subject: Re: [PATCH 2/7] mm/thp: try_to_unmap() use TTU_SYNC for safe DEBUG_VM splitting To: Hugh Dickins Cc: Andrew Morton , "Kirill A. Shutemov" , Wang Yugui , Matthew Wilcox , Naoya Horiguchi , Alistair Popple , Ralph Campbell , Zi Yan , Miaohe Lin , Minchan Kim , Jue Wang , Peter Xu , Jan Kara , Linux MM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 3, 2021 at 7:45 PM Hugh Dickins wrote: > > On Thu, 3 Jun 2021, Yang Shi wrote: > > On Tue, Jun 1, 2021 at 2:07 PM Hugh Dickins wrote: > > > > > > Instead of abandoning the unsafe VM_BUG_ON_PAGE(), and the ones that > > > follow, use PVMW_SYNC in try_to_unmap_one() in this case: adding TTU_SYNC > > > to the options, and passing that from unmap_page() when CONFIG_DEBUG_VM=y. > > > It could be passed in the non-debug case too, but that would sometimes add > > > a little overhead, whereas it's rare for this race to result in failure. > > > > The above statement makes me feel this patch is just to relieve the > > VM_BUG_ON, but my patch already changed it to VM_WARN, the race sounds > > acceptable (at least not fatal) and the splitting code can handle the > > failure case as well. So I'm wondering if we still need this patch or > > not if it is just used to close the race when CONFIG_DEBUG_VM=y. > > I do agree that your 1/2 (what I'm calling 6.1/7) BUG->WARN patch > is the most important of them; but it didn't get marked for stable, > and has got placed behind conflicting mods never intended for stable. Sorry for not marking it for stable. I do have no any objection to having it in stable, just forgot to cc stable. :-( > > And a lot of the descriptions had been written in terms of the prior > situation, with VM BUG there: it was easier to keep describing that way. Understood. > > Whether your fix makes mine redundant is arguable (Wang Yugui thinks > not). It's easier to argue that it makes the racy ones (like this) > redundant, than the persistent ones (like vma_address or pvm_walk). The point is if we just close the race for DEBUG_VM case, it doesn't sound worth it to me IMHO. How's about making it for !DEBUG_VM anyway? How big the overhead could be? It looks like the heavy lifting (tlb shootdown and page free) is done after pmd lock is released so it should not block pvmw for a long time. > > Since I know of at least one customer who wants all these fixes in 5.10 > longterm, I'm fighting to get them that far at least. But the further > back they go, the less effort I'll make to backport them - will fall > back to porting your BUG->WARN only. > > Hugh