Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp159834ybl; Mon, 12 Aug 2019 13:41:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3bPgOU0up9s60ZXHw3jybHbmifKcbnE30ylgPzH5lbID89OsKBnrdeNKJ9faqUBV1oh+X X-Received: by 2002:a17:902:fa5:: with SMTP id 34mr29665438plz.285.1565642505909; Mon, 12 Aug 2019 13:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565642505; cv=none; d=google.com; s=arc-20160816; b=zi/j4O2or3vIuRoEiiKLvUvV1Vr/u7747iGG13JZVXSphQ63t1PEH0moK3GsLf9EE1 z+83FMZqBZnaaRWf3swSu0DYtq6md/X4Fsf5bYCzaITQGefMEHb60jDsIv0Vql965pX1 MmwICB+Z9HuRivkHeRlZWn8QPA0Y0yRbGTcxFxslqwuyAFTg2B1QzHmWJRjNoIQEgD1Q iknsU7LBfgHbVy0vU0Zzp6ev8Zn2PbzNItZJ11EWq9D4ya4iTVQFDdw1/7BymSlGLTr8 fUc4wCyXSyVEX+AGFV0W3ZK348Qh4uPecxT5GhQLGOnzpMG2/v1IcRVeBHdsnt3bda63 Wtzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=OvGyvW5Iklte0Ea4752AqZSzCvI47sv01KixS4E1a7s=; b=OB1s9Eh2+s8BRQZz4eN2rJLp2OnNHmdaK+NiYwdXpwMRnzEviihucuSgUVK3owkVzh 2WZX1qX7U1sOM6n2CalA9hLuHvIak6FnyjkSIUt1pvOFKdc+hLoA15wTVM4EGih/mK6x KcI5UCeCACNIELUMx6ceNhSYwpZiaR8ZMVxtMNH7gscumQBKkvgUfzAezjpKxCGcFSMD A4bEi9S27/3Qt/mgF37r4duyP1fsdmSReN58/o//D7dsqD6Brsym67T5m16x8mI31MWg 7lvKxX1Pcd5xd8NInDa8Jegtdda3ARTJrXMFjO/6k6IPm8FWsAmk70LkacDbakWdfoEi 8Wag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=02IXqmiP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si13758741ply.218.2019.08.12.13.41.28; Mon, 12 Aug 2019 13:41:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=02IXqmiP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbfHLUid (ORCPT + 99 others); Mon, 12 Aug 2019 16:38:33 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38729 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbfHLUic (ORCPT ); Mon, 12 Aug 2019 16:38:32 -0400 Received: by mail-pl1-f196.google.com with SMTP id m12so9705604plt.5 for ; Mon, 12 Aug 2019 13:38:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=OvGyvW5Iklte0Ea4752AqZSzCvI47sv01KixS4E1a7s=; b=02IXqmiPZReQAgyCJd5XNSGkstTKxtHUCQnsagaaTI/Nh5YcPVKftq4hsoImftWUiy UNSJu/7l6MF1Uxfqn0NJMq7zLVQWoWjNBYVt6UcKgPMAj4J3vLYX67YbINJzY8O3BvxS t59P7WwHqAVA9qyEwtZTq4zBCZwRtvgHdH/2NeLIfUbRhknUrJmreVlGM4iBrRFbGyKa FB0S3uNTBf3hEp40WFwr6mnjtWn8CazvUeaTEtQaPHox5O79Zq5gAYLY2pnV99UNu5fX Idy85JpYma2zzK/JF1tyDIb57JjheW480EHyTesQUyYt/1+5SNmYiKuQxPLzDnLN41NU /AQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=OvGyvW5Iklte0Ea4752AqZSzCvI47sv01KixS4E1a7s=; b=FlFlahTFzQkumcgNEBb6SPYq0Q4VK2QdqtT6p4K0tAOUYMQbbGZzkocpD+c/mQuVmO V13y/TlaCUF4f38Wst5gcBxGfhcV6Yf/onyqvvt2ewrmkyFiPrrmD7XMplJ79n3uZp5l Tq3kwxtV9lBGNB5zrKiW8r4rv/kGw7WRvqy9fS+nXipJqD0AVBHKEPX+UcJFVsdPA94G B4rWQG3rVcK5fEYULXzGJ7SUyi/1tuKLKuQvnR41HKhTCjQ6/jEkudNUUwYE5pck+B4m zerA/0neqwARZ81c/1ko4otCiMOlGYyjipxWxgN5y8y0Cp0NtE/TrU7vC9XyVLSJiFJA q3sQ== X-Gm-Message-State: APjAAAVHca9B6Ccr0aWvBKGPmRCjk/6qPjnOH+6VZmSqID0nwJ7FXE2Y rocJBf30TIkm+UtraRaXNX32Xg== X-Received: by 2002:a17:902:74c4:: with SMTP id f4mr33092313plt.13.1565642312071; Mon, 12 Aug 2019 13:38:32 -0700 (PDT) Received: from localhost ([2620:10d:c091:500::2:f08]) by smtp.gmail.com with ESMTPSA id cx22sm387516pjb.25.2019.08.12.13.38.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 12 Aug 2019 13:38:31 -0700 (PDT) Date: Mon, 12 Aug 2019 16:38:29 -0400 From: Johannes Weiner To: Song Liu Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, matthew.wilcox@oracle.com, kirill.shutemov@linux.intel.com, kernel-team@fb.com, william.kucharski@oracle.com, akpm@linux-foundation.org, hdanton@sina.com Subject: Re: [PATCH v10 7/7] mm,thp: avoid writes to file with THP in pagecache Message-ID: <20190812203829.GC15498@cmpxchg.org> References: <20190801184244.3169074-1-songliubraving@fb.com> <20190801184244.3169074-8-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190801184244.3169074-8-songliubraving@fb.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 01, 2019 at 11:42:44AM -0700, Song Liu wrote: > In previous patch, an application could put part of its text section in > THP via madvise(). These THPs will be protected from writes when the > application is still running (TXTBSY). However, after the application > exits, the file is available for writes. > > This patch avoids writes to file THP by dropping page cache for the file > when the file is open for write. A new counter nr_thps is added to struct > address_space. In do_dentry_open(), if the file is open for write and > nr_thps is non-zero, we drop page cache for the whole file. > > Cc: Johannes Weiner > Reported-by: kbuild test robot > Acked-by: Rik van Riel > Acked-by: Kirill A. Shutemov > Signed-off-by: Song Liu Acked-by: Johannes Weiner