Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2096314ybg; Thu, 24 Oct 2019 04:47:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyR5+kRNdPrVGfVT+xykWl3M0OHoSxZpJipvo/QcGLn3HGyHAYS/ZIcryjlBVAyaWq7eGJT X-Received: by 2002:aa7:d3c4:: with SMTP id o4mr15295175edr.194.1571917650635; Thu, 24 Oct 2019 04:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571917650; cv=none; d=google.com; s=arc-20160816; b=dX5BePAgmBDeV5p/MU8TBaBS3srlIHQl2WKzEgNoPitZuZvTvmjCO2EjIGQcHw3f5v 9aduilUTcX3nxU1A4S6hcTs8uGoY76XGXcG5rHLLZfmDKLShVS8XV/kYJajtlNKg7Z11 7CSEvP526hhAZIg50KzTm/PUv6JhNe4UHrfpZ4qpX9yXVCICsqLHXFHtaARnZTWeqdq8 MpYcJZJh5idfeuW8y/onQ3VZUDucMXeKIESUXDEKw3bgRLpxNpDUTt85jm7Jz3cCVji/ +6eg+vLaCj5F/jdiQJJeLUqQ698bb6QhnArIiowqfx4nbZ5VgU0zidhlUlIPFEkqD/i3 4a1w== 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=bG3/WLQ3BKtHlYI3WFB7izs5MtpxdRb40qU5GLuq7Kc=; b=fupyu0eLZA7N4z0n8g+wcBpOmGSeYm9LnXzZ0rW/k7rV0P0fFnV+kMGpo66Ez4by8W SFgPw9iCH4Zv00O0e3GutHrQDvpZLRCEuoCDqCPTPRdxFHqxISnEeHGxsO/CAOnoPbhn UHK9XV+j2X0B7g4LB3qbV4ogIX5xOHpdX3ZoUnwLh00FGJzYu0iDUR57LMV8jilbCrMM YY3Grru6l/ex9GcvJEgKachmeiPFxwAF0V/opRUqduBU+O6sTFbH9bed3ghjCsVFzq8f SweU9Axp5myTuP8mgwbiq4G4NY01IAmq3nP+KSKA2111T2W8Y4ZXJfrgtXQ1+Veofhwu r3cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uGPIy0Zl; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u6si15831735eds.173.2019.10.24.04.47.06; Thu, 24 Oct 2019 04:47:30 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=uGPIy0Zl; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729266AbfJWRY0 (ORCPT + 99 others); Wed, 23 Oct 2019 13:24:26 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:32780 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727079AbfJWRY0 (ORCPT ); Wed, 23 Oct 2019 13:24:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bG3/WLQ3BKtHlYI3WFB7izs5MtpxdRb40qU5GLuq7Kc=; b=uGPIy0ZlzUq7xee7gYH6zC3G2 pSrOyTAvWP+Wpg6vgAZSinr7A2/uNC+nOEmCHmCOqLTI8/zJvB+NLkxefC248I+ClUm+cwguY+Nln i2myUnQID2xvEzjNYXcRnH8vMWKtCF64XjrlHnPS4x02FrIsPQGxBNGyWP+pHdwlqDXK2KYql6Smm b/VttAo5viTNxoBVU/xaMwnpd/goLs5Uf3vsX9NKku6Qk7xB7NAmSuVrOGChBDT/j0bVb7HrZjlZE yblsP/9LqUE4osPgpwuuiFPziJsaIIm+qmX4gSbd5fFkKKoVZcevHIu1LvRofn9XdxY1AvtHUgeZx ZC6VLKRlA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNKMu-0006oY-I8; Wed, 23 Oct 2019 17:24:20 +0000 Date: Wed, 23 Oct 2019 10:24:20 -0700 From: Matthew Wilcox To: Yang Shi Cc: hughd@google.com, aarcange@redhat.com, kirill.shutemov@linux.intel.com, gavin.dg@linux.alibaba.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [v2 PATCH] mm: thp: handle page cache THP correctly in PageTransCompoundMap Message-ID: <20191023172420.GB2963@bombadil.infradead.org> References: <1571850304-82802-1-git-send-email-yang.shi@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1571850304-82802-1-git-send-email-yang.shi@linux.alibaba.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 24, 2019 at 01:05:04AM +0800, Yang Shi wrote: > + return map_count >= 0 && > + map_count == atomic_read(&head[1].compound_mapcount); > } I didn't like Hugh's duplicate definition either. May I suggest: diff --git a/include/linux/mm.h b/include/linux/mm.h index 2f2199a51941..3d0efd937d2b 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -695,11 +695,6 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) extern void kvfree(const void *addr); -static inline atomic_t *compound_mapcount_ptr(struct page *page) -{ - return &page[1].compound_mapcount; -} - static inline int compound_mapcount(struct page *page) { VM_BUG_ON_PAGE(!PageCompound(page), page); diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 2222fa795284..270aa8fd2800 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -221,6 +221,11 @@ struct page { #endif } _struct_page_alignment; +static inline atomic_t *compound_mapcount_ptr(struct page *page) +{ + return &page[1].compound_mapcount; +} + /* * Used for sizing the vmemmap region on some architectures */