Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3861771pxb; Wed, 13 Oct 2021 14:44:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6X+sI2Oki98kUbWHhldUC3lHEEPbtRSY8jRvmrGf0CPgGNKY13Kgl6riI5WLrzvxmHAWe X-Received: by 2002:a17:90b:350f:: with SMTP id ls15mr2002031pjb.220.1634161473944; Wed, 13 Oct 2021 14:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634161473; cv=none; d=google.com; s=arc-20160816; b=rnYGuwnovuslN2+6P15a+e9Jd8Fz7XKy3xZyRu62kUpL2JvhBseDeP/r10ZXBLTUO6 gnJx5+iB/ZwnjMjb4vPzvUaH/IyQ0nixiZDJkQWvHDhLG+ao6kYN0xHZ4qiJfrZNHc/6 25a2PSh7To58usVdX8RM5Uw0ROb7SrTF2QpH3Vc5AbQi9P1nxzUr14u+o0gmyRxPCLj0 ReFdSdHKAJ8BUYp9aZ3QMpSbzK3v37NbD4VRQR9BIlIxbwHaeEUeVpmP1/21ugUGaIlK zusJTz4Ip+DJoz5wGI6ACETus4nuhkB4luI8PQvjANenseP/Ah8YFCbwkezK1jd5ToAg zNsA== 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=+74ZuFQnhra1mA1yYzIx/vvNdxWlZMlZrX1c1bZpxQM=; b=pekL/iCipJ7uL36So644bgIcP7iIyADHmRnJ8AMVYl3ti1jbHzsbkouVmUE2oyzAUE hNnavwfuS0LQz85AYWvZCuXZO/Cg2tBPuihUEOSq+IgsSiW/jM6AsGeCFHICYGFEcZCC 9nroTO3NDj/gX/peivtFLzrSDeLAKRGPj6Y2ZDJDK68WNNS3toDniPEsw9/ZQsFZncxM sVuvW2UZkQZlYI6FQL6rd22Qem64AZRpdAcR2eTKU6zvSnPEJGUAMxi3/8C7+5BVmncj B3MMHO5uKQIp+eCxhh6VzYDMdRyQSXiliKYMZAK1plf+8QGYlOH++/HYbxWt2wk4Fg4Z qIHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mZC4pT++; 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 s20si911016pga.158.2021.10.13.14.44.19; Wed, 13 Oct 2021 14:44:33 -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=20210112 header.b=mZC4pT++; 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 S230153AbhJMVpA (ORCPT + 99 others); Wed, 13 Oct 2021 17:45:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229881AbhJMVo7 (ORCPT ); Wed, 13 Oct 2021 17:44:59 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 975D3C061570; Wed, 13 Oct 2021 14:42:55 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id t16so15912819eds.9; Wed, 13 Oct 2021 14:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+74ZuFQnhra1mA1yYzIx/vvNdxWlZMlZrX1c1bZpxQM=; b=mZC4pT++UMEOauA4S5g8YTkpiJT3CPeW6UBji2zCvAvlZmBYIsXB3UU+bQPMBvM1Sr aw24uTe6odebY5TY6caJLOAxOYisGTqjcpNffBqf6VrFB2cuiMq5tIH2+ZbmB39eR3ka SE4rX/119ghNd45eGNppFMcMsFC+D9cB74ShLm+W1q3ROL0HDkvJjKAGXqVnPl9kVnlD SVUkE4nDALNivePSINq5hG2KpEUM0gtTNkl0MO+GBggjUZkn+sW2bnv1kXqKl/WLB1PC OMJ3NcPwajOfk1Q2q9umNygvEEizenOB2Aa5f0L/NpzyUPTB7X+3f26XRkxlyaqph0mc m+aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+74ZuFQnhra1mA1yYzIx/vvNdxWlZMlZrX1c1bZpxQM=; b=vr/+/+Kc30J+MZ0XrmqJxWHGsULFqzogOc+P/33TPUdXtYoMJ5AwRIB4i70036IGdU vk+AZ7HbNW5Nnf9YibJjnuOcnDFUlCDUZ0nkrwlvnYYCk59+LM4uOF4bmxcOYOd9JGZT O3GXGSD/Qson5g+inxPCMaaVLXET8yDy/0XHRpQOnVU9cJd4GhhA1U7CdW215iasdqvX Y+iPOghvl0/3YKCJ3jOz9oVK7Slc6+AcN0CWt6oeqVbD7BAyz2jD7KRg8VbsAOxkqJsw 0JKsJaa6CWtJ4U+7jg43iX4TiPk4w+x+t4HB/X0av1gBDDxlhnJvw4j6UoUPwkouSD6e tUkA== X-Gm-Message-State: AOAM532UAk+xUl5N5IPMJl4a9uQwgFbjfecZZ3UjR6cX4m8Ns5OAX4L9 CfH6nvVpi65kejEgVoVwJ5+YW4gMhcqMdycKc5Q= X-Received: by 2002:a17:906:a94b:: with SMTP id hh11mr2073351ejb.85.1634161374135; Wed, 13 Oct 2021 14:42:54 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Yang Shi Date: Wed, 13 Oct 2021 14:42:42 -0700 Message-ID: Subject: Re: [v3 PATCH 2/5] mm: filemap: check if THP has hwpoisoned subpage for PMD page fault To: Peter Xu Cc: =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Hugh Dickins , "Kirill A. Shutemov" , Matthew Wilcox , Oscar Salvador , Andrew Morton , Linux MM , Linux FS-devel Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 12, 2021 at 8:41 PM Peter Xu wrote: > > On Tue, Oct 12, 2021 at 08:27:06PM -0700, Yang Shi wrote: > > > But this also reminded me that shouldn't we be with the page lock already > > > during the process of "setting hwpoison-subpage bit, split thp, clear > > > hwpoison-subpage bit"? If it's only the small window that needs protection, > > > while when looking up the shmem pagecache we always need to take the page lock > > > too, then it seems already safe even without the extra bit? Hmm? > > > > I don't quite get your point. Do you mean memory_failure()? If so the > > answer is no, outside the page lock. And the window may be indefinite > > since file THP doesn't get split before this series and the split may > > fail even after this series. > > What I meant is that we could extend the page_lock in try_to_split_thp_page() > to cover setting hwpoison-subpage too (and it of course covers the clearing if > thp split succeeded, as that's part of the split process). But yeah it's a > good point that the split may fail, so the extra bit seems still necessary. > > Maybe that'll be something worth mentioning in the commit message too? The > commit message described very well on the overhead of looping over 512 pages, > however the reader can easily overlook the real reason for needing this bit - > IMHO it's really for the thp split failure case, as we could also mention that > if thp split won't fail, page lock should be suffice (imho). We could also Not only for THP split failure case. Before this series, shmem THP does't get split at all. And this commit is supposed to be backported to the older versions, so saying "page lock is sufficient" is not precise and confusing. > mention about why soft offline does not need that extra bit, which seems not > obvious as well, so imho good material for commit messages. It would be nice to mention soft offline case. > > Sorry to have asked for a lot of commit message changes; I hope they make sense. Thanks a lot for all the great suggestions. > > Thanks, > > -- > Peter Xu >