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 89071C43217 for ; Tue, 11 Jan 2022 20:22:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E46BF6B00C6; Tue, 11 Jan 2022 15:22:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF5986B00C7; Tue, 11 Jan 2022 15:22:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBD006B00C8; Tue, 11 Jan 2022 15:22:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id BE3BF6B00C6 for ; Tue, 11 Jan 2022 15:22:03 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6B95792E02 for ; Tue, 11 Jan 2022 20:22:03 +0000 (UTC) X-FDA: 79019127726.15.8737B8A Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by imf07.hostedemail.com (Postfix) with ESMTP id 16FFC4000E for ; Tue, 11 Jan 2022 20:22:02 +0000 (UTC) Received: by mail-pl1-f172.google.com with SMTP id g5so491126plo.12 for ; Tue, 11 Jan 2022 12:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FwRE6lWGEei45bkbMJKeSP3Ud1XwG78sUDvZWgOWgpo=; b=cjzdDhMq5PVoq65mBc5qeuyiZFFdVdMaVzlF66W+jYzN7SAeFYI+z7X68c8D05b+eb AUIKlWMpCDZEhOa0wUgKUzDKs971LKDdwfYnyq87X2rHdCzB7Djk+CRpNwvFbHEBQS0r mhta2JxLCwm99SAb+n5p9+LUROFrash/1mz2zJKWdE9kbFp7LHaiu5mpR5aUjueNX+OE xhsYe0stuWCucbA0XyMwNphRb3qpVxW+235kdg6kvUGHnp/E0VfXD45nWnbBFdSjsDso I8iXL4zF8cdcg5uWt5of0FuMgCDkidGdWM+566+9Up6yMrLIiyu8T1sSja+jNUwNwElz kZvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=FwRE6lWGEei45bkbMJKeSP3Ud1XwG78sUDvZWgOWgpo=; b=rL4LYqD94TzYPD7WNRALX+QsG8yF/PwUq94/fuJg0FHw/Beg966G/RYcXjNG8fO7ES ptnloj/GY8mwWv4FbZCsbmEXEv4MIuV3/BffV/M9ac6VmP8u38cb/bcxaBdjE7izUomY 4fO+lmuRNB9LTXTos/KlhamJTdo0y9YZ+BkbtnhXJEYkeoXV+b65oUbWpxEUfgD0XYCb 7lFq+TKn4GNlNS9fGvPHnCKR3qi7H53/HdILoPbiiVuJrQw8Hhr+8K191JdgCBfhhzXQ 3ej0tAWs5NDBF8nus3HXSUjA+Xb/7r+WeMd3C+vig5lfPRATUBOMpxraYkBWXICXqPKB T+eQ== X-Gm-Message-State: AOAM533tcnTbjexO3yxH9iPONOfLKL2UmlUpOjEFFeElSvU9qi9S91RE kQGstm9l+Bx3Kbq3X22+ByU= X-Google-Smtp-Source: ABdhPJxtm4p16eLqvWbpcaznKxK781NoOA7XdbozbbQmSuwmCZr+fWSSn7Kc4rLWEPu32xzYvTmCZw== X-Received: by 2002:aa7:9094:0:b0:4bd:8f39:236e with SMTP id i20-20020aa79094000000b004bd8f39236emr6092357pfa.35.1641932522088; Tue, 11 Jan 2022 12:22:02 -0800 (PST) Received: from google.com ([2620:15c:211:201:4f0e:ffc8:3f7b:ac89]) by smtp.gmail.com with ESMTPSA id q13sm11581369pfj.65.2022.01.11.12.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 12:22:01 -0800 (PST) Date: Tue, 11 Jan 2022 12:21:59 -0800 From: Minchan Kim To: John Hubbard Cc: Yu Zhao , Mauricio Faria de Oliveira , Andrew Morton , linux-mm@kvack.org, linux-block@vger.kernel.org, Huang Ying , Miaohe Lin , Yang Shi Subject: Re: [PATCH v2] mm: fix race between MADV_FREE reclaim and blkdev direct IO read Message-ID: References: <20220105233440.63361-1-mfo@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 16FFC4000E X-Stat-Signature: kyr1mjr89ic5kbybzimpz4ij46ptrihd Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cjzdDhMq; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf07.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.214.172 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com X-Rspamd-Server: rspam03 X-HE-Tag: 1641932522-158141 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 Tue, Jan 11, 2022 at 12:20:13PM -0800, Minchan Kim wrote: < snip > > > > slow path with __gup_longterm_unlocked and set_dirty_pages > > > for them). > > > > > > This approach would solve other cases where map userspace > > > pages into kernel space and then write. Since the write > > > didn't go through with the process's page table, we will > > > lose the dirty bit in the page table of the process and > > > it turns out same problem. That's why I'd like to approach > > > this. > > > > > > If it doesn't work, the other option to fix this specific > > > case is can't we make pages dirty in advance in DIO read-case? > > > > > > When I look at DIO code, it's already doing in async case. > > > Could't we do the same thing for the other cases? > > > I guess the worst case we will see would be more page > > > writeback since the page becomes dirty unnecessary. > > > > Marking pages dirty after pinning them is a pre-existing area of > > problems. See the long-running LWN articles about get_user_pages() [1]. > > Oh, Do you mean marking page dirty in DIO path is already problems? ^ marking page dirty too late in DIO path Typo fix.