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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 CD57EC11F64 for ; Thu, 1 Jul 2021 05:20:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6233061462 for ; Thu, 1 Jul 2021 05:20:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6233061462 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D23A88D0292; Thu, 1 Jul 2021 01:20:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD3A88D028E; Thu, 1 Jul 2021 01:20:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC2E88D0292; Thu, 1 Jul 2021 01:20:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 95E688D028E for ; Thu, 1 Jul 2021 01:20:45 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 51B01180D8739 for ; Thu, 1 Jul 2021 05:20:45 +0000 (UTC) X-FDA: 78312869250.26.AB6F604 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf10.hostedemail.com (Postfix) with ESMTP id AD2B96001AA5 for ; Thu, 1 Jul 2021 05:20:44 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B1B5E6D; Wed, 30 Jun 2021 22:20:43 -0700 (PDT) Received: from [10.163.88.72] (unknown [10.163.88.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B7AD63F694; Wed, 30 Jun 2021 22:20:41 -0700 (PDT) Subject: Re: [PATCH V2] mm/thp: Make ALLOC_SPLIT_PTLOCKS dependent on USE_SPLIT_PTE_PTLOCKS To: Matthew Wilcox Cc: linux-mm@kvack.org, akpm@linux-foundation.org, Vlastimil Babka , Randy Dunlap , linux-kernel@vger.kernel.org References: <1621409586-5555-1-git-send-email-anshuman.khandual@arm.com> From: Anshuman Khandual Message-ID: <9d1ce685-e0fd-febd-5ff2-179f7fa6e3fa@arm.com> Date: Thu, 1 Jul 2021 10:51:27 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of anshuman.khandual@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=anshuman.khandual@arm.com; dmarc=pass (policy=none) header.from=arm.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: AD2B96001AA5 X-Stat-Signature: u4kq5gge9e4u8q8zoqeh5745zxd1t7xs X-HE-Tag: 1625116844-616261 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 5/20/21 4:47 PM, Matthew Wilcox wrote: > On Wed, May 19, 2021 at 01:03:06PM +0530, Anshuman Khandual wrote: >> Split ptlocks need not be defined and allocated unless they are being used. >> ALLOC_SPLIT_PTLOCKS is inherently dependent on USE_SPLIT_PTE_PTLOCKS. This >> just makes it explicit and clear. While here drop the spinlock_t element >> from the struct page when USE_SPLIT_PTE_PTLOCKS is not enabled. > > I didn't spot this email yesterday. I'm not a fan. Isn't struct page > already complicated enough without adding another ifdef to it? Surely > there's a better way than this. This discussion thread just got dropped off the radar, sorry about it. None of the spinlock_t elements are required unless split ptlocks are in use. I understand your concern regarding yet another #ifdef in the struct page definition. But this change is simple and minimal. Do you have any other particular alternative in mind which I could explore ? > >> +++ b/include/linux/mm_types.h >> @@ -152,10 +152,12 @@ struct page { >> struct mm_struct *pt_mm; /* x86 pgds only */ >> atomic_t pt_frag_refcount; /* powerpc */ >> }; >> +#if USE_SPLIT_PTE_PTLOCKS >> #if ALLOC_SPLIT_PTLOCKS >> spinlock_t *ptl; >> #else >> spinlock_t ptl; >> +#endif >> #endif >> }; >> struct { /* ZONE_DEVICE pages */