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=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 7E7EEC433E9 for ; Tue, 2 Feb 2021 01:02:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0921B64EE0 for ; Tue, 2 Feb 2021 01:02:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0921B64EE0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6368C6B0005; Mon, 1 Feb 2021 20:02:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E6EE6B0006; Mon, 1 Feb 2021 20:02:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 487976B006E; Mon, 1 Feb 2021 20:02:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 334E66B0005 for ; Mon, 1 Feb 2021 20:02:18 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EB3693630 for ; Tue, 2 Feb 2021 01:02:17 +0000 (UTC) X-FDA: 77771526714.19.base28_0803206275c6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id BB4971AD1B2 for ; Tue, 2 Feb 2021 01:02:17 +0000 (UTC) X-HE-Tag: base28_0803206275c6 X-Filterd-Recvd-Size: 4902 Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Feb 2021 01:02:16 +0000 (UTC) Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 1120eF6i125569; Tue, 2 Feb 2021 01:02:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=laC4NgN9xK+AQJl4qaBbqB3Fxreko3AwfTNfPWOWl6Q=; b=0NLqs/yK9VPDRolCsOIoSUzDmsi+tPIElB1ZkLEOjA1ZcYxfhlK81y3xHrJb3q+9t7Ag 7iAxEEzEXl5wqUEq5XmbEo8AfhL/PBfAGe94aSZZNXARdUSMzCpVqHX3sJgl5OM+B4I3 L6c9WUxsauog60tjF0IC9cGia2opCbyYEraGtWJrwngYst5VLNKnh0xN+XRf3DLoKxXV xje9BZmXVFiPEw+oyt6u2muFo/GItkHhqtv+YjMkQ9MaVrGLs6EhkuolOs8C4GOqVA60 JSjQX2hxXwZWg4UcekN0+RGO6Te94nHn55QvJMQSEEngm/5uWsWWuhTWDZcvhNJYQdEN zQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 36cxvr09w0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 01:02:13 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 11210YIU114726; Tue, 2 Feb 2021 01:02:13 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 36dhcvubak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 02 Feb 2021 01:02:13 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 11212Ckv006051; Tue, 2 Feb 2021 01:02:12 GMT Received: from [192.168.2.112] (/50.38.35.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Feb 2021 17:02:12 -0800 Subject: Re: [Bug 211287] New: Softdirty bit does not work with hugetlb From: Mike Kravetz To: shu wang Cc: Linux Memory Management List References: <999775bf-4204-2bec-7c3d-72d81b4fce30@oracle.com> <6aa94855-c204-83a6-98e5-2841f1b00b16@oracle.com> Message-ID: Date: Mon, 1 Feb 2021 17:02:11 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <6aa94855-c204-83a6-98e5-2841f1b00b16@oracle.com> Content-Type: text/plain; charset=iso-2022-jp Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=651 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020003 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9882 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=659 mlxscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 suspectscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2102020002 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 1/22/21 1:50 PM, Mike Kravetz wrote: > On 1/22/21 10:42 AM, shu wang wrote: >> Our use case is: >> We maps both PMEM and hugetlb DRAM to process’s address space to provide large amount of memory to the application. Periodically, we clear the soft dirty bit by writing ‘4’ to the clear_refs. Then, we check the page’s soft dirty bit from pagemap and use this information to track write activity to memory. We migrate the data between DRAM and PMEM based the write activity for better performance. >> > > Thank you for the information! > > If someone does not beat me to it, I should be able to look at this next week. Just a quick update. The /proc clear_refs code handles THP pages and 'normal' pages. There is no check/processing for hugetlb pages. All the code will do is clear the VM_SOFTDIRTY vma flag and vma_set_page_prot. None of the individual ptes or page flags are touched. The only soft dirty checking done by the /proc pagemap code is at the vma level. It checks the VM_SOFTDIRTY flag. It does not look for soft dirty on the individual ptes. That explains the behavior described in the bug report. With a quick and dirty hack I could make the code work in limited testing. Much work remains. If anyone wants to jump in and help, feel free. -- Mike Kravetz