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=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,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 0643CC433DB for ; Wed, 27 Jan 2021 23:37:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 94E3760C40 for ; Wed, 27 Jan 2021 23:36:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94E3760C40 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 276906B0005; Wed, 27 Jan 2021 18:36:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 224AB6B006C; Wed, 27 Jan 2021 18:36:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C4366B006E; Wed, 27 Jan 2021 18:36:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id E5FF46B0005 for ; Wed, 27 Jan 2021 18:36:58 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A41253634 for ; Wed, 27 Jan 2021 23:36:58 +0000 (UTC) X-FDA: 77753167716.01.crime69_3513cb82759b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 8550A1004ED7E for ; Wed, 27 Jan 2021 23:36:58 +0000 (UTC) X-HE-Tag: crime69_3513cb82759b X-Filterd-Recvd-Size: 13738 Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Wed, 27 Jan 2021 23:36:57 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10RNFMTI120191; Wed, 27 Jan 2021 23:36:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2020-01-29; bh=NxsoP6LZIIriYwWOadOhSSOFWa60pgRlgKoPwSaLfNs=; b=nNfzr9pezrVr20yNT18m214enf+U+QzIXfUm60rDvLWyQbVp2cwru2TIFVVP0n160Qlc qC7hXHuV+06lxC86Z6AfkOzWm3Rlds7KVfOGT/m+hC5OvU5AhDbzhwpcayloKpvRs0fu jauu/MtTM4bDUSijmyP6OTou/hDTGcWg2QDPf+fRXRH4h9AV2tXh/aLu/4H6HGiHqn03 XkA1XvlnWRz8Na6JTzLLneSGODnhZGhJG8vWpB/2zdz/MgRJIS69VKeQ1gZzTaXQiNcX KAw5PYFfc8Lx4vnYeDc7glIrGCnk/UKf/q1NIr0iaPqTMkM+GWHY1Z2D/+VO+fkA79Yh Og== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 3689aasve2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Jan 2021 23:36:46 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 10RNGBbW194940; Wed, 27 Jan 2021 23:36:45 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by userp3030.oracle.com with ESMTP id 368wqyfm1j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Jan 2021 23:36:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QF7gUStS5A3jpTeHpxeDM5uCOhdzucKrNa9Eokjcd3uYSRpZ0Jjb7i+Yas/bQMc6dLdczvTTZRT/bRDh4xos5Xgiw37ecISDn5XHQ8IPQYzv54QQvG96luV8M171Uxw+kAOaFWweqZu+giPB3zZLTjgJy1HcZlnnUN4GaFwB5LxC1j0fYf1nZu08zP+T8t15LLE8O5CjNWNOgu6bLC4XbMCNl7B20hze1sxLSFyuWLMMurd695DaqgR2VN63QfB6SaZT3v8EhKqhxmKbHseylT7drlbTerlbycYDmg51NlCyVAQFV7ISloAnDfek0iZSpF30WmJxEnXat8FJIC5+uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NxsoP6LZIIriYwWOadOhSSOFWa60pgRlgKoPwSaLfNs=; b=RUVr6cHsM7xr4UXd3j32iOXziwNmA/MhAISouVF/+5eBgEtxgqsV++dLwkVkBww7GqLx4uAX1rMNw/cjMzEFjW8gIXQCIXhBrmq87NoIISWA3XaNe2GRIHjOhsOfyzuC2ZgAbRsevbSdi/D1Gzr19d9HzR/JBOp/xDGLzwzrnVT+7MZH8mX8xhl6DxhJeWjPNIbK6LdBs1Z+nxuLKG3DWjQ5om5iqBxZHQJ+gR5Spl6MpyERDMMvsADQPpdggPIs5bpMr69C096hwr/j1ZO6EkTLHmt44NV/flG7MmDPlvFkRYwcwTxV7h61bDhH+LL8RWvVMwq1STvUBqeF/cGEFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NxsoP6LZIIriYwWOadOhSSOFWa60pgRlgKoPwSaLfNs=; b=qu79aCPQyPr1d86AgJ2XlZFDbiAjMnU6pDocbldFxry0cRdO4blbr4N89DkJy/RAxEGsNSR15WrgKa+JwC15c/1m0ZJbBwy5Qttt2rIXSTcnMxPHEa30xm7d3KBa3s0hu1tL+kLpZg0eqVEdf4wPeYGCeYobwsN/6zj4XtBKr5s= Authentication-Results: linux-foundation.org; dkim=none (message not signed) header.d=none;linux-foundation.org; dmarc=none action=none header.from=oracle.com; Received: from MWHPR10MB1389.namprd10.prod.outlook.com (2603:10b6:300:21::22) by CO1PR10MB4609.namprd10.prod.outlook.com (2603:10b6:303:91::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.16; Wed, 27 Jan 2021 23:36:42 +0000 Received: from MWHPR10MB1389.namprd10.prod.outlook.com ([fe80::897d:a360:92db:3074]) by MWHPR10MB1389.namprd10.prod.outlook.com ([fe80::897d:a360:92db:3074%5]) with mapi id 15.20.3784.019; Wed, 27 Jan 2021 23:36:42 +0000 Subject: Re: [PATCH v3 3/5] hugetlb: only set HPageMigratable for migratable hstates To: Michal Hocko , Oscar Salvador Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Naoya Horiguchi , Muchun Song , David Hildenbrand , Matthew Wilcox , Miaohe Lin , Andrew Morton References: <20210122195231.324857-1-mike.kravetz@oracle.com> <20210122195231.324857-4-mike.kravetz@oracle.com> <20210127103523.GI827@dhcp22.suse.cz> From: Mike Kravetz Message-ID: <2196d93e-f573-7163-183e-0ad2cec7555e@oracle.com> Date: Wed, 27 Jan 2021 15:36:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 In-Reply-To: <20210127103523.GI827@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [50.38.35.18] X-ClientProxiedBy: MW4PR03CA0110.namprd03.prod.outlook.com (2603:10b6:303:b7::25) To MWHPR10MB1389.namprd10.prod.outlook.com (2603:10b6:300:21::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.2.112] (50.38.35.18) by MW4PR03CA0110.namprd03.prod.outlook.com (2603:10b6:303:b7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.16 via Frontend Transport; Wed, 27 Jan 2021 23:36:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1d1155b-341e-46c9-e2da-08d8c31c66a1 X-MS-TrafficTypeDiagnostic: CO1PR10MB4609: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xHeG7/YkpmCFemH1kC94lzdTVVECy75HeC5qm0xtnvtT75+3lRl6GS9Fagw1O1v6fBbyFEx5JpkRphnRLRMwAaQ/0LKjCpDDyd98p8LIQDseOSaAGSBcqCr7HsniEKGkjTzeRzznGP4LzGDyTPBUyk/wVRS0usn6zMkzxUgoGXj80liBLK4rsthNQ7gXebB3kR7AV4ndU1zjkfYFkEKJ8tak0ZRJ5zxW6/z5W/isfqfyqlte3scD+rsnEyaDW2xLhHmjEZVnaYBcQu2w5C/tg4aSQNwTclR3aYxYu1uSpGT7vzW/maObSBEmbJfPzSeSpryC7pi25bWeEUnKIUOhK3i/JZJx+vs7MdvGUC7AF+YtMtc/YQKckoi++56xxUd5RjskycDfkPt2oo0dj3ZMIl7r4Teg34zIzNqw9rtogOgiUs1c0i1ZUzNhamjwVndkGM7+XVKa8KdkNQVJYKqN89mhX+mivuVvOk+E+VokvF0LegYOb35RlHWlg49O49ICvg8u+zes88a6R/W04xvU9OacUOLwxza89VLjg/xZ1movxeX0D6s97gDYfBJ+C8N9+TQ49QQu/iRNsej49kSXJ32bcd4IEGMov9IoiSRu4VI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR10MB1389.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(136003)(396003)(366004)(346002)(39860400002)(7416002)(4326008)(186003)(2616005)(8676002)(44832011)(478600001)(16576012)(31686004)(956004)(16526019)(31696002)(6486002)(83380400001)(110136005)(26005)(316002)(53546011)(86362001)(54906003)(52116002)(5660300002)(66556008)(66476007)(8936002)(36756003)(66946007)(2906002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?czhCSFZmS3lkTE0yQjdld3lSaHAwV3lzQlQ4YkNyMktqMzMrNlFmOVo0a0FJ?= =?utf-8?B?M3Q5WmJacHJTZGIwN1Rha1kvR2JMYVNmQkZzMHIrMWNpQmhnckdLSjhQWE9D?= =?utf-8?B?czRLdEZIYmUvY0laOEJwMlkyNEdZVEh4cXBoZ2I3T1RvcVNvMlpwWEVrNnpE?= =?utf-8?B?TlUzazhQY2hPZ0FYTjlGai9XNHZrNGhnV1lSWGJBUkxOYVYvYmRHRFVIZTM4?= =?utf-8?B?TDE1ME02V3hwVllyMGhLV1pneGdONGhWdkpPMUdNZ1JlQndPakp3b2t6NU05?= =?utf-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Gc0V1E0ckVWQWpBT21J?= =?utf-8?B?TWJPTXRqVEhqalhEajk1akM1R2ppQUdkSlJPY2ljWjBwaktnNzk5aEFJbEVz?= =?utf-8?B?bndEN2ZnY21SMW1VWWFEU1RVaEF5SkdNUFB5ZDZFSTUzMkEwNHByUlhDUU1O?= =?utf-8?B?MlR4YWJXWllabjIrYXZXaDJrRmRQYVlpajh1L2lzeWg0Mk9jWkdoell2WWZv?= =?utf-8?B?MENEd1NURzJaNnJNZGhjZlF4Y3lKNWtsRUtFUzRMbWQ2bmdsMnhzejJhWitn?= =?utf-8?Q?BAUk6Out?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1d1155b-341e-46c9-e2da-08d8c31c66a1 X-MS-Exchange-CrossTenant-AuthSource: MWHPR10MB1389.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2021 23:36:42.4229 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KqNToq65E2f6/7SW0P4PYhEzHsVins/YcXBUNrRcHGY2t0/oG+48YWahBcfK1NdeCKlxZ46MJoy0d6K0n0s2cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4609 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9877 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 phishscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101270116 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9877 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=999 clxscore=1015 phishscore=0 bulkscore=0 spamscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101270116 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 1/27/21 2:35 AM, Michal Hocko wrote: > On Fri 22-01-21 11:52:29, Mike Kravetz wrote: >> The HP_Migratable flag indicates a page is a candidate for migration. >> Only set the flag if the page's hstate supports migration. This allows >> the migration paths to detect non-migratable pages earlier. If migration >> is not supported for the hstate, HP_Migratable will not be set, the page >> will not be isolated and no attempt will be made to migrate. We should >> never get to unmap_and_move_huge_page for a page where migration is not >> supported, so throw a warning if we do. >> >> Signed-off-by: Mike Kravetz >> --- >> fs/hugetlbfs/inode.c | 2 +- >> include/linux/hugetlb.h | 9 +++++++++ >> mm/hugetlb.c | 8 ++++---- >> mm/migrate.c | 9 ++++----- >> 4 files changed, 18 insertions(+), 10 deletions(-) >> >> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >> index e1d7ed2a53a9..93f7b8d3c5fd 100644 >> --- a/fs/hugetlbfs/inode.c >> +++ b/fs/hugetlbfs/inode.c >> @@ -735,7 +735,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, >> >> mutex_unlock(&hugetlb_fault_mutex_table[hash]); >> >> - SetHPageMigratable(page); >> + SetHPageMigratableIfSupported(page); >> /* >> * unlock_page because locked by add_to_page_cache() >> * put_page() due to reference from alloc_huge_page() >> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h >> index 58be44a915d1..cd1960541f2a 100644 >> --- a/include/linux/hugetlb.h >> +++ b/include/linux/hugetlb.h >> @@ -740,6 +740,15 @@ static inline bool hugepage_migration_supported(struct hstate *h) >> return arch_hugetlb_migration_supported(h); >> } >> >> +/* >> + * Only set HPageMigratable if migration supported for page >> + */ >> +static inline void SetHPageMigratableIfSupported(struct page *page) > > This is really mouthful... > >> +{ >> + if (hugepage_migration_supported(page_hstate(page))) >> + SetHPageMigratable(page); > > and it is really a trivial wrapper. I do understand why you want to > prevent from the code duplication and potentially a missing check but > this all is just an internal hugetlb code. Even if the flag is set on > non-migrateable hugetlb page then this will not be fatal. The migration > can fail even on those pages for which migration is supported right? > > So I am not really sure this is an improvement in the end. But up to you > I do not really have a strong opinion here. Yes, this patch is somewhat optional. It should be a minor improvement in cases where we are dealing with hpages in a non-migratable hstate. Although, I do not believe this is the common case. The real reason for even looking into this was a comment by Oscar. With the name change to HPageMigratable, it implies that the page is migratable. However, this is not the case if the page's hstate does not support migration. So, if we check the hstate when setting the flag we can eliminate those cases where the page is certainly not migratable. I don't really love this patch. It has minimal functional value. Oscar, what do you think about dropping this? -- Mike Kravetz