From patchwork Fri Nov 12 15:08:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 12616965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 949E7C433F5 for ; Fri, 12 Nov 2021 15:09:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2AFF560F4B for ; Fri, 12 Nov 2021 15:09:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2AFF560F4B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 96FA86B0080; Fri, 12 Nov 2021 10:09:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9204D6B0081; Fri, 12 Nov 2021 10:09:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7730D6B0082; Fri, 12 Nov 2021 10:09:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0223.hostedemail.com [216.40.44.223]) by kanga.kvack.org (Postfix) with ESMTP id 68A456B0080 for ; Fri, 12 Nov 2021 10:09:28 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 31C257F717 for ; Fri, 12 Nov 2021 15:09:28 +0000 (UTC) X-FDA: 78800612016.11.6F04353 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id E996CB000195 for ; Fri, 12 Nov 2021 15:09:15 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1ACEeV4L005374; Fri, 12 Nov 2021 15:09:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2021-07-09; bh=6K3dV9kT1TePMQHNEat9vbBQo8pBmM+K6iChvFRe6Gk=; b=X4rsohgvpwKbYk45fF9eYWadE/tfrlGhd8HDj1/mZI5K2pLPu5N7VBgg8a9O2mnPWs0j EbaneeEmylB+vTWBjmTLlTd9F4X5vKkVW3pktmwAUk1fGmolbe6tV5k4Pn26FtA9fgzU jLzUFqDiMYV0B7imRfBYm/ke226+ILLr8d1568cHDsiRKAwmF7MXUvJefnELH2dCzjsr ulyGFhc1chvTewN4FOaNLAE2di5PjlxFi+PEAC74TufMH89kynK4Jz0OuMy0DuPIyMWp 0BKWoOz4Q9+nHdVDS57JIHan1cpUetS0pPE9a4EIwwC0p91cWHuv7FT8acyHc6s5kCo6 4w== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3c9ruc8k06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Nov 2021 15:09:20 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1ACF5wiD196345; Fri, 12 Nov 2021 15:09:19 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2043.outbound.protection.outlook.com [104.47.57.43]) by userp3030.oracle.com with ESMTP id 3c842f8xn2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Nov 2021 15:09:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZWw6Shegvz6GfqqCyc7hvigeiWrB5yzvSmVCyYDpflpGAXos8LgwVHmY8B81kxD6yPuHSDFuL8qqHcgMQ9+FTS7TSPjbG3cpU/8lpJ6tPuoYtqosJ30ieW/F+M/pCS9vCOaL5cbkDroZPpp8txenp+gx5NPBYL4l8E5acE5h/AR8kunnBUzNoF6yaagX2NkqFtP16akIS/HuP1LK5vkzBUWwI9p1XzNolHkfV3hAyGnErG3qqbX5ahvNSewGWM3XVR/IspJBaPOYtosiMVotwmObNivbtkN0E+t1GtYIEBYwzKz+EwQrepbm+HQyCoHHvOR/5EG06tw6Mhwi7ac5ug== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6K3dV9kT1TePMQHNEat9vbBQo8pBmM+K6iChvFRe6Gk=; b=gIdcO+nYtWE7FVzuGybWdlL9sncrrc46NsSGdonlcMrxsMGv5QPUrZGKVzYqQKnlzMk6xStZhHi4kKz4qLaoZPLgmRhLe92n6R9hLAankoyNtLZ+gCq96J8jcP5XF/RH/hzWIzQchyWHWyj+ZdCnTi5bRzHE+lmZhIffZ+MK2JdjiXLyD0j2pXabBND6MHgXct0gMZYNBR9VjrgDzHZ3FRDh+muCvIOe8QT6pV9Eq6zeRkeNP5eISzqxnX91TGrW8CL/jQUmF03wwIBeNtq0K30B9uuCNrSSZ9LDg20jc/3Kva2Yzzl1uCH/ojvqJBIyHJNWb0XeAWRdsa7Y/7MvZg== 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=6K3dV9kT1TePMQHNEat9vbBQo8pBmM+K6iChvFRe6Gk=; b=BXp3qkkztlpCo8aPnz5HoM0ppec/QnNkDkwypW7UIgWQRmbH/anF5H7C4NBHqmu2+WO7MCzCoLUG/N96/DRrHsbrcBU+laZK8jjF5ru0xdxKFwWu1dMB3hAz1oz7yW1H2ZOV5rEqqi13yRfix334YmX1h7yw1Qd6db7ASo6OjIQ= Received: from BLAPR10MB4835.namprd10.prod.outlook.com (2603:10b6:208:331::11) by MN2PR10MB4223.namprd10.prod.outlook.com (2603:10b6:208:1dd::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.17; Fri, 12 Nov 2021 15:09:17 +0000 Received: from BLAPR10MB4835.namprd10.prod.outlook.com ([fe80::d809:9016:4511:2bc6]) by BLAPR10MB4835.namprd10.prod.outlook.com ([fe80::d809:9016:4511:2bc6%8]) with mapi id 15.20.4669.016; Fri, 12 Nov 2021 15:09:17 +0000 From: Joao Martins To: linux-mm@kvack.org Cc: Dan Williams , Vishal Verma , Dave Jiang , Naoya Horiguchi , Matthew Wilcox , Jason Gunthorpe , John Hubbard , Jane Chu , Muchun Song , Mike Kravetz , Andrew Morton , Jonathan Corbet , Christoph Hellwig , nvdimm@lists.linux.dev, linux-doc@vger.kernel.org, Joao Martins Subject: [PATCH v5 5/8] device-dax: use ALIGN() for determining pgoff Date: Fri, 12 Nov 2021 16:08:21 +0100 Message-Id: <20211112150824.11028-6-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20211112150824.11028-1-joao.m.martins@oracle.com> References: <20211112150824.11028-1-joao.m.martins@oracle.com> X-ClientProxiedBy: AM3PR07CA0134.eurprd07.prod.outlook.com (2603:10a6:207:8::20) To BLAPR10MB4835.namprd10.prod.outlook.com (2603:10b6:208:331::11) MIME-Version: 1.0 Received: from paddy.uk.oracle.com (138.3.204.9) by AM3PR07CA0134.eurprd07.prod.outlook.com (2603:10a6:207:8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4690.12 via Frontend Transport; Fri, 12 Nov 2021 15:09:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 404dfb93-7827-401e-080c-08d9a5ee651d X-MS-TrafficTypeDiagnostic: MN2PR10MB4223: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8NuI8sMaR8nnbyJF/ag8vSkrznw+YjLw9DZxlHPYEY+Vi4PNfpj7Q5PSt0SvAAueU69ymX59184wGJWHlgIR6bW0NSrn3ZVXAFYnYkmcMIgSfDo+Kxzy5IGEobCbo2k5Vn+RTDE0OFeKMjEX5oMNnUEhIgqV2a/tLy/irVV0UUP2qhxA8gKGAvwfJWlJCyPukqcrokSqlUDBAffxFUCP5uRJhDdVhek07IZGjoIcCNiUm4/an/L2Bgc+ihTb5SAFDIh+D0JR8CYBpcbv8FQVfAWly/NpOiPL4EsF0ZwZgknr8pqGOIyZcFdf+beShclF3Bm8Ofb8QWI8xIiyppK6z4kAWqTRl4aU13jJU21hmSlsAA0IkcQ05+HQ/fHp6t33eci3P4+FOd3aZbT8OWyci+VMNr3s/OWzItI+fkvx3rZEQMjTLdrLn6qEjlThGnyZ1J+YWH3yj57Qwelz/d8kmxO2vbCnnCN0luu2SXVfW9nmjctpXlakly/E4mdkx/MJPZzk8mR+4Tv7fYUKNI5peM58VoL1TdwQJcy88TDMSy20bbVkgbztU6ZlWBYiyqaZ9Gh/nG/YsOZn8xO6QuesLR3SV2XRH9GTawQVmtbncDx8GhxXtKHNrbwg9xzV9hzdFBasSAMR5IbwtaGZHSaXcv6tR9Z3Ctrh9NF7kxVUJzNeW7CfEb5pK/L0EaDxPcqwi0+pBqDkeuIRkxtqhuCdiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BLAPR10MB4835.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(7696005)(5660300002)(2616005)(107886003)(2906002)(38350700002)(38100700002)(66946007)(6916009)(6486002)(66476007)(54906003)(1076003)(66556008)(6666004)(52116002)(4326008)(8936002)(86362001)(36756003)(103116003)(186003)(316002)(26005)(956004)(4744005)(83380400001)(508600001)(8676002)(7416002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NxIHogO7ILVXRFcUssSlXbfJu1J2FnrKCo13Z2AtH6anAgeLXBplQ8PJUqE4vqdBOVeqLsYrSM8iQwHkIwTLVFVaghE1/IiPOU5euDQOUEmIUgGskEU9TOZHd/BZ2s37tq5/sR33fMNW+xbU9CDzgn1Th6+uJOKeGS+flGwc8goHSCsCiXSppON5OG78nbRpewmtHVwEf9ICFZBpMzjAQPMLU8YLyLq/YQfoQwT6pXDlfZgLPUkMfbJhTMIePyK7tET9C6NnoV7dHfpA+Rx+svS8xdrF0kTdLB9czqImFNlyrbfI9ZLEsdSPX4ROwUsWTs5tO3BwsAXW/gSc2qp54YlA30SI7HadbNJzu+0fklL0P90P3lF4uiu5SkNo5obAQF2vVe3Fp5crY03Sc58BNP5qNC5wiJfADBPazvOlbXLHeGgdHA5VJWHmFnFRF91tP9b/jjAfraxDyiJCHAr/XHGPy16Rdc2/BvMQqYYwADNCxi0n/CpQvko6SyMLrDiT1cdCE6FcZ9Rg4EaiUM+V+dqHUxo6FFblevMoIZVlWorIPUVGF7AAX0a8uWS5wJz5Mc+vqNBnYn/6/ReQtJD6jRqK4JG0NLZM3O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IA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 404dfb93-7827-401e-080c-08d9a5ee651d X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB4835.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2021 15:09:17.0928 (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: GylyENWzD5pB74llvh5f1fYOo/Ru5Qx1HzhRuwmHj2nZHHApAdHm9cKHHZrJPEy09k1dzsXhrG3rWzB0mU/9qEji0DqC/JBX7hrXK5M5HvQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4223 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10165 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 spamscore=0 suspectscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111120087 X-Proofpoint-ORIG-GUID: RyaQEB82cnhYmcSIJz4N1WJtjqEKqYVt X-Proofpoint-GUID: RyaQEB82cnhYmcSIJz4N1WJtjqEKqYVt X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: E996CB000195 X-Stat-Signature: xba53jppwm61s9fdsrow5wcsnn4gxiq5 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=X4rsohgv; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BXp3qkkz; spf=none (imf19.hostedemail.com: domain of joao.m.martins@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=joao.m.martins@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-HE-Tag: 1636729755-339084 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: Rather than calculating @pgoff manually, switch to ALIGN() instead. Suggested-by: Dan Williams Signed-off-by: Joao Martins Reviewed-by: Dan Williams --- drivers/dax/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index dd8222a42808..0b82159b3564 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -234,8 +234,8 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, * mapped. No need to consider the zero page, or racing * conflicting mappings. */ - pgoff = linear_page_index(vmf->vma, vmf->address - & ~(fault_size - 1)); + pgoff = linear_page_index(vmf->vma, + ALIGN(vmf->address, fault_size)); for (i = 0; i < fault_size / PAGE_SIZE; i++) { struct page *page;