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=-8.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 1D30CCA9EA1 for ; Fri, 18 Oct 2019 13:32:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D493C222C5 for ; Fri, 18 Oct 2019 13:32:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="qaiuU0Go" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D493C222C5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5AD2E8E0005; Fri, 18 Oct 2019 09:32:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 50F3D8E0003; Fri, 18 Oct 2019 09:32:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3887E8E0005; Fri, 18 Oct 2019 09:32:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id 0CD798E0003 for ; Fri, 18 Oct 2019 09:32:36 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id A494118017BD8 for ; Fri, 18 Oct 2019 13:32:35 +0000 (UTC) X-FDA: 76056995070.26.taste66_50c0236998816 X-HE-Tag: taste66_50c0236998816 X-Filterd-Recvd-Size: 5243 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Oct 2019 13:32:34 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id 195so4730979lfj.6 for ; Fri, 18 Oct 2019 06:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=syfG/SB9c17JrhI1N+k3VpvBr6cBzB/Bcv38TbgnCxM=; b=qaiuU0GoVjsz/FcEqLxFFZ8qZsTLE3jHdRFi++Ifuafz0dbtwSO+XYhUrSxl2sf4Vh 3nBdCnCbfb2bAfDAegfpRX3zsvhPjlZCAKt3qS/w9rrf6QVThLrKDZG3yLeCGfhVkG3E +CN7Gjmezq3qLL7oDOQwbe0tRoGLZzFVVk3CzWbrbVFWRkS435+D0a9f1iAlRqar60LU SKqys5I2rTnXWhAYMHS3JAUCn7Oeuij/i5Ga51hMeAEKGkpZOn2b4J4xNSHm4BE93Nie qvJR3macVG00ZvCX2a+l++KLa83rTMENA7yJbLjdDhpKEC/GcjBfsk0R+/OE+gAP0NMQ 2nfw== 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=syfG/SB9c17JrhI1N+k3VpvBr6cBzB/Bcv38TbgnCxM=; b=sD7kXAFl5L5kNogV5EQFG2XmU/Yy+lOGr9o4oXfsMjJXvSWryNDKzT5tSAEYVXevCU 0isX1C/HIlyFfzAArLYtYJ4fUeZfapRi9QljFFJrGVX1N6cdAmhzFw8y2V2rkE9USbBJ stP9ynuUciqvjNMzQX8yXP3c7/XJ+hkcGzrBSjWfmP+MeyuUH8NBfKIYQCpA4WtEqqjR vDhlM6Tedj6r1e8YEUgXpz7RbS2yDgB7UH48Wdw1DQwC4ICK5Qun/zp7q9sRKPLdC7ss xc5IXaIGQNJwSCyrCT+Fm/mstFwLdxerE2+gs/LHSL0KopRaKih8XRu/bzdnj8JOkzhS Gp2g== X-Gm-Message-State: APjAAAUWdistVtXIVSsOhYvWLGkG0huPJx8X9gAreIygojnq4hFivfVi jIpZH+APn3FDvYOXBlaLXi4Vhw== X-Google-Smtp-Source: APXvYqwrxtLRmt+8UAyTlIHQEatVXYuACllCoLjAk0nlKHS8TfYkWurnoaWInEMJmJg0RIhdnUw+sw== X-Received: by 2002:ac2:4196:: with SMTP id z22mr6088549lfh.171.1571405553345; Fri, 18 Oct 2019 06:32:33 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id 77sm2273995ljj.84.2019.10.18.06.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Oct 2019 06:32:32 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 13348100D76; Fri, 18 Oct 2019 16:32:31 +0300 (+03) Date: Fri, 18 Oct 2019 16:32:31 +0300 From: "Kirill A. Shutemov" To: Yang Shi Cc: Song Liu , Linux Kernel Mailing List , Linux MM , Andrew Morton , matthew.wilcox@oracle.com, kernel-team@fb.com, william.kucharski@oracle.com, "Kirill A. Shutemov" Subject: Re: [PATCH v2 4/5] mm/thp: allow drop THP from page cache Message-ID: <20191018133231.vifgnueulyo57vpy@box> References: <20191017164223.2762148-1-songliubraving@fb.com> <20191017164223.2762148-5-songliubraving@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 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 Thu, Oct 17, 2019 at 02:46:38PM -0700, Yang Shi wrote: > On Thu, Oct 17, 2019 at 9:42 AM Song Liu wrote: > > > > From: "Kirill A. Shutemov" > > > > Once a THP is added to the page cache, it cannot be dropped via > > /proc/sys/vm/drop_caches. Fix this issue with proper handling in > > invalidate_mapping_pages(). > > > > Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS") > > Signed-off-by: Kirill A. Shutemov > > Tested-by: Song Liu > > Signed-off-by: Song Liu > > --- > > mm/truncate.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/mm/truncate.c b/mm/truncate.c > > index 8563339041f6..dd9ebc1da356 100644 > > --- a/mm/truncate.c > > +++ b/mm/truncate.c > > @@ -592,6 +592,16 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, > > unlock_page(page); > > continue; > > } > > + > > + /* Take a pin outside pagevec */ > > + get_page(page); > > + > > + /* > > + * Drop extra pins before trying to invalidate > > + * the huge page. > > + */ > > + pagevec_remove_exceptionals(&pvec); > > + pagevec_release(&pvec); > > Shall we skip the outer pagevec_remove_exceptions() if it has been done here? It will be NOP and skipping would complicate the code. -- Kirill A. Shutemov