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 9525FC433EF for ; Wed, 15 Jun 2022 20:16:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 987CC6B0071; Wed, 15 Jun 2022 16:16:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9374D6B0072; Wed, 15 Jun 2022 16:16:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D8376B0074; Wed, 15 Jun 2022 16:16:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 700556B0071 for ; Wed, 15 Jun 2022 16:16:58 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 2C841120FE9 for ; Wed, 15 Jun 2022 20:16:58 +0000 (UTC) X-FDA: 79581578916.19.BB92D85 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id BBD0F18008A for ; Wed, 15 Jun 2022 20:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655324217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KkwY3eR126FjGjzwDQgo3l2d+v/rND/Bs0ek1ca5Ghc=; b=NTuZRm1tm6s6b5BQ2tsxkUMEioQQLxhVodZIXO6GfPuP4757/TDQe8irKAUdixxARBiVib L9qPe3UkERuA6qPdSNRVkwTZzRIvk0k1szuWHzmcLfyKdGYLjjns3x1mWFGe3P0sFgwouS e+SHWx/8oNfqhpNXoftHWXsMKEvdLCQ= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-534-FYX_B3D5PISi3voETdM7Ww-1; Wed, 15 Jun 2022 16:16:56 -0400 X-MC-Unique: FYX_B3D5PISi3voETdM7Ww-1 Received: by mail-il1-f198.google.com with SMTP id b11-20020a92340b000000b002d3dbbc7b15so9084727ila.5 for ; Wed, 15 Jun 2022 13:16:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KkwY3eR126FjGjzwDQgo3l2d+v/rND/Bs0ek1ca5Ghc=; b=VhVx75+z2m1Pet340VwE0lUxgM0p8aczCQhIQoTgy5VXkZDyKfMi5tyg8miZG7IQjt D8Zcjad+FS7HnW7teSDwde7ELnMDzlMln3i1eI2bVHNMVSnUk3C/ZbXRWP90B2It9P86 hNaczg0mdzGs5x0Te/IeFLIG15ltBYZnByMGWD+zzlSzlEGv/JUYk57IJpnKAc7BHQ+A 6w1MRwWqzEg+xbIqpzQ37+IjAd0OZT0qynCAF3CYAhqjT1Br4PCty7fRDuDkYHOcaK1U x+4NwhkpBL4/hNSZ83OdC57nLiR3TQyRvYSUYPN2ZLLijOvSIBUq3eJyxLdbu/pWExVf MH8w== X-Gm-Message-State: AJIora+uKlnBzzryQw2PV0Cyy6idcYIGHjPSK7bA9l6tgds2bImyHHwu 3jx1cp6bzGuQYNY2S3NwQHVO7dhLHDNhz04SjOvyIvGm1yd2B4amnNpbqGikKfrBkcmdemI2gGN aR1M2RzN8nMc= X-Received: by 2002:a05:6e02:1bc1:b0:2d1:96b3:b961 with SMTP id x1-20020a056e021bc100b002d196b3b961mr918518ilv.213.1655324215648; Wed, 15 Jun 2022 13:16:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tq2RmeOc+Cw38JYNDWY4FM4DxM7BCAIfsjmCVReo6Nm54OPHKau5ma9UITXSGSPYXAKWiOXA== X-Received: by 2002:a05:6e02:1bc1:b0:2d1:96b3:b961 with SMTP id x1-20020a056e021bc100b002d196b3b961mr918500ilv.213.1655324215446; Wed, 15 Jun 2022 13:16:55 -0700 (PDT) Received: from xz-m1.local (cpec09435e3e0ee-cmc09435e3e0ec.cpe.net.cable.rogers.com. [99.241.198.116]) by smtp.gmail.com with ESMTPSA id e98-20020a02866b000000b00331a3909e46sm6551771jai.68.2022.06.15.13.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 13:16:54 -0700 (PDT) Date: Wed, 15 Jun 2022 16:16:53 -0400 From: Peter Xu To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Collingbourne , Linus Torvalds , Andrew Morton , Nadav Amit , Dave Hansen , Andrea Arcangeli , Yang Shi , Hugh Dickins , Mel Gorman Subject: Re: [PATCH v3] mm/mprotect: try avoiding write faults for exclusive anonymous pages when changing protection Message-ID: References: <20220614093629.76309-1-david@redhat.com> <3f190cd4-df87-feeb-bae4-56348498fa82@redhat.com> MIME-Version: 1.0 In-Reply-To: <3f190cd4-df87-feeb-bae4-56348498fa82@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655324217; a=rsa-sha256; cv=none; b=p6dcaQePyaIquTGjbB7+1FwrG0KdXOp2ckS94ETFvkFMBYhdE5BFE0zVJg6MmNyjAqq36R //UZtAUMvm81OoEe7sB+Sdy/R1jG9bgpikqj5Njq5WfR/igHvEa8LBChyTUXDsxb+n/lzo 9vIHb24Vu3suxy4rqSWFCYeBRQ11N+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655324217; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=KkwY3eR126FjGjzwDQgo3l2d+v/rND/Bs0ek1ca5Ghc=; b=dhsngt/vYd4k0x1OwYBiWcoJXO5C26AEJgm18CYUDduiLS0dwlTGIEpFtK7rD+t7vo8oyD MKVOabDw/JeVPhvcOWYLbN4zDlmTHvkf0DMsTAOHZveqYGQ3n/ssxX7HH+2kbIyvRJUUZ4 /5rKFKMWCkPT+Oc6ZJAqP9xJP4Dl4XY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NTuZRm1t; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf16.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NTuZRm1t; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf16.hostedemail.com: domain of peterx@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=peterx@redhat.com X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: BBD0F18008A X-Stat-Signature: fegnperts45eu6ckgiczskrjjy1bghjs X-HE-Tag: 1655324217-485749 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, Jun 15, 2022 at 09:52:11PM +0200, David Hildenbrand wrote: > write unprotection is a change from RO->RW, so I don't immediately see > the difference. In my view "unprotect a pte" is only a subset of "grant pte write permission", since: "unprotect" has a prerequisite that it used to be "protected" so that's why we can unprotect. Aka, in mm term that's only when VM_WRITE set. So basically it is a hint that we're only working on VM_WRITE regions, where I thought "unprotect" was slightly better. > > Anyhow, I don't like the sounding of TRY_WRITE_UNPROTECT. > > I made it match the function name that I had: > > MM_CP_TRY_CHANGE_WRITABLE > -> !pte_write()? > -> can_change_pte_writable() ? > ->pte_mkwrite() > > Maybe MM_CP_TRY_MAKE_WRITABLE / MM_CP_TRY_MAKE_PTE_WRITABLE is clearer? > > Open for suggestions because I'm apparently not the bast at naming > things either. Me neither. I don't have a strong opinion anyway, and frankly indeed the old naming is not great either to me. Maybe there's better thoughts. Thanks, -- Peter Xu