Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1141512ybp; Wed, 9 Oct 2019 09:22:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGJ9Wd0ZPHrK1hQH/n3z7p1dUb8VO3CktlKZHVUaPsFawT/z1bOwcTUpIc9rqzc/ZYVzh8 X-Received: by 2002:a17:906:470d:: with SMTP id y13mr3647653ejq.241.1570638124008; Wed, 09 Oct 2019 09:22:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570638124; cv=none; d=google.com; s=arc-20160816; b=EuGsz1GFoUb2i8O7jCQARRHst+598yaNAIPxoxeo6KE3oT6DECOOIBu8gLz9v94QbM prpu912vtI71LjCQegx2vcPC1BS5eQ0Vpe6gq+F6Vd3ImDw9XumrgeWl+0X2HT2Vdast YNRBXi3W84K7W5/SCKVcIsYmI+fzRKDKbExWwxqtTfaZh5wz46KcAGP06DbA/lGLB94L kfRghTJJhJLXvzX2VUz8WE/u1n0Qb30SBy7ML71VDsDdpDbPXFi3L+4iFkITk5B9paqZ g/HTabW8+AV/JIUBRLt3nQDFxytod5EET/ifE/drJlv8LJZABnsT71OaBBnHBNcR70E+ Ki4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :dkim-signature; bh=Xyn3ZXW4DvG5x49nqnZxjKfo8EFXrWgePlqit3F07J8=; b=gu7DTkfJ7XQeuLE1VJc5JsZgv/Xv5C2tM81Ep+ROTz5WYdvdyB/DwgXK4l0Ri80JBh dZ04e5K2HO4y8cB+rO+j+mnKyI2668k6CVnrqNKZwLPLszSV3mQhcypHUY/Cicqr2nkO rI4BHGXfx+edrVDmmIcPU3+36mCmfiF6zvyje2agq0ilptXUGOkusxUi1g28EKcw5pI8 bqFq4J/C4SPyYU4cSFW2h/rpcRDUEUTWHgMrYlcRCNE6awmHhfgJwl9GfX6JP41W1dLg ci6RIfQlsrFNl66d1WZRecRC0+ZY007LSEj7Ci6J+v7k2LSdXobt5POd+MxuHUDinbMN A+Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=L1LgQkaa; 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 gh12si1418258ejb.191.2019.10.09.09.21.39; Wed, 09 Oct 2019 09:22:03 -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 (test mode) header.i=@shipmail.org header.s=mail header.b=L1LgQkaa; 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 S1731789AbfJIQUg (ORCPT + 99 others); Wed, 9 Oct 2019 12:20:36 -0400 Received: from pio-pvt-msa3.bahnhof.se ([79.136.2.42]:49724 "EHLO pio-pvt-msa3.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731083AbfJIQUg (ORCPT ); Wed, 9 Oct 2019 12:20:36 -0400 Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id E43AA3F503; Wed, 9 Oct 2019 18:20:27 +0200 (CEST) Authentication-Results: pio-pvt-msa3.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=L1LgQkaa; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -2.099 X-Spam-Level: X-Spam-Status: No, score=-2.099 tagged_above=-999 required=6.31 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XHAqkNolIUYl; Wed, 9 Oct 2019 18:20:24 +0200 (CEST) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 95D1C3F315; Wed, 9 Oct 2019 18:20:22 +0200 (CEST) Received: from localhost.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id F0AC936016C; Wed, 9 Oct 2019 18:20:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1570638022; bh=15nrot/7wNjB0kN4+a5UAu154h85Yrs+uYJfO3V81ZI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=L1LgQkaa61DY0KI5m3lwcwTx0pPa3Jl4tKDsCKiHxLn2Kv4bhXtKKhdHjJ9ok69OA qe44WjgVeRB0eyhf7YyfKwgHD/7TdPOHPUqMlkgNbvNT4BOBMdejyxs93VMYaGe8r/ neaDUtO2LuwYqORXgYFLnzZdZxFrgwiM3vlYJVtk= Subject: Re: [PATCH v4 3/9] mm: pagewalk: Don't split transhuge pmds when a pmd_entry is present To: "Kirill A. Shutemov" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, torvalds@linux-foundation.org, Thomas Hellstrom , Matthew Wilcox , Will Deacon , Peter Zijlstra , Rik van Riel , Minchan Kim , Michal Hocko , Huang Ying , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= References: <20191008091508.2682-1-thomas_os@shipmail.org> <20191008091508.2682-4-thomas_os@shipmail.org> <20191009152737.p42w7w456zklxz72@box> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28VMware=29?= Organization: VMware Inc. Message-ID: <467a4a34-27be-8f46-2c9a-c5b335d11438@shipmail.org> Date: Wed, 9 Oct 2019 18:20:21 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20191009152737.p42w7w456zklxz72@box> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Kirill. Thanks for reviewing. On 10/9/19 5:27 PM, Kirill A. Shutemov wrote: > On Tue, Oct 08, 2019 at 11:15:02AM +0200, Thomas Hellström (VMware) wrote: >> From: Thomas Hellstrom >> >> The pagewalk code was unconditionally splitting transhuge pmds when a >> pte_entry was present. However ideally we'd want to handle transhuge pmds >> in the pmd_entry function and ptes in pte_entry function. So don't split >> huge pmds when there is a pmd_entry function present, but let the callback >> take care of it if necessary. > Do we have any current user that expect split_huge_pmd() in this scenario. No. All current users either have pmd_entry (no splitting) or pte_entry (unconditional splitting) > >> In order to make sure a virtual address range is handled by one and only >> one callback, and since pmd entries may be unstable, we introduce a >> pmd_entry return code that tells the walk code to continue processing this >> pmd entry rather than to move on. Since caller-defined positive return >> codes (up to 2) are used by current callers, use a high value that allows a >> large range of positive caller-defined return codes for future users. >> >> Cc: Matthew Wilcox >> Cc: Will Deacon >> Cc: Peter Zijlstra >> Cc: Rik van Riel >> Cc: Minchan Kim >> Cc: Michal Hocko >> Cc: Huang Ying >> Cc: Jérôme Glisse >> Cc: Kirill A. Shutemov >> Suggested-by: Linus Torvalds >> Signed-off-by: Thomas Hellstrom >> --- >> include/linux/pagewalk.h | 8 ++++++++ >> mm/pagewalk.c | 28 +++++++++++++++++++++------- >> 2 files changed, 29 insertions(+), 7 deletions(-) >> >> diff --git a/include/linux/pagewalk.h b/include/linux/pagewalk.h >> index bddd9759bab9..c4a013eb445d 100644 >> --- a/include/linux/pagewalk.h >> +++ b/include/linux/pagewalk.h >> @@ -4,6 +4,11 @@ >> >> #include >> >> +/* Highest positive pmd_entry caller-specific return value */ >> +#define PAGE_WALK_CALLER_MAX (INT_MAX / 2) >> +/* The handler did not handle the entry. Fall back to the next level */ >> +#define PAGE_WALK_FALLBACK (PAGE_WALK_CALLER_MAX + 1) >> + > That's hacky. > > Maybe just use an error code for this? -EAGAIN? I agree this is hacky. But IMO it's a reasonably safe option. My thinking was that in the long run we'd move the positive return codes to the mm_walk private and introduce a PAGE_WALK_TERMINATE code as well. Perhaps a completely clean and safe way would be to add an "int walk_control" in the struct mm_walk? I'm pretty sure using an error code will come back and bite us at some point, if someone just blindly forwards error messages. But if you insist, I'll use -EAGAIN. Please let me know what you think. Thanks, Thomas