From patchwork Tue Jul 18 14:58:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13316794 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1642FEB64DA for ; Tue, 18 Jul 2023 06:57:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 786C88D0001; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7374F8D0002; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D88A8D0001; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 49E196B0074 for ; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0ABFC8017A for ; Tue, 18 Jul 2023 06:57:49 +0000 (UTC) X-FDA: 81023827458.14.22A3855 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf23.hostedemail.com (Postfix) with ESMTP id AF7E0140005 for ; Tue, 18 Jul 2023 06:57:45 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=none (imf23.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689663466; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lmokLjL1ZdWwvs8pSvOSUEHDMQWTjqQvTzRCzH0jxKU=; b=ArTrU1vNNVYz5IGVlSBDKJ8k7Jxvi6RtpE/QxxIO7YfmnFhBSLUXBsBB3O+i7W79/QQBwb PRRyAabxY7V6oJnBC4txtHQzr1CmbUVBamZR4vwuYrIjekE6YQC6AVjK7a9eO24rQeZGtW 1gzY0muvOL0ibWkMzl3DPajb3U5pR6Q= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=none; spf=none (imf23.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689663466; a=rsa-sha256; cv=none; b=OkX5wIHZwKs++XG06gSeEe8vFdlMj4jaK9maPQ3Kf7VZ+RoQeM5BiQRDnfGO7gQDuPERQ8 /jaRK93c+9v/WdnsAfp2lDnsDlTyg08CVa4wla59KCwTj1bpCh2LOW7pzXZT5sKKCutfxF O12ur5vCyrXp/KZsd4d+g7WQRidnzAo= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4R4qX0578pz4f3tmj for ; Tue, 18 Jul 2023 14:57:36 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgB3a+nfN7Zk36ikOA--.34217S3; Tue, 18 Jul 2023 14:57:37 +0800 (CST) From: Kemeng Shi To: akpm@linux-foundation.org, pasha.tatashin@soleen.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 1/3] mm/page_ext: add common function to get client data from page_ext Date: Tue, 18 Jul 2023 22:58:10 +0800 Message-Id: <20230718145812.1991717-2-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230718145812.1991717-1-shikemeng@huaweicloud.com> References: <20230718145812.1991717-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: Syh0CgB3a+nfN7Zk36ikOA--.34217S3 X-Coremail-Antispam: 1UD129KBjvdXoWruF48ZF1kJFy3AF1Uur13CFg_yoWfZwc_Aw 1xtr48Gr1IvF9avw1UKw1xtFy5t3y8Gr47XF1ktrZ0yrnrKrs0ya18JasxXw4kWr1fXr9r Ca1kWrnrtr17ujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb6AFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUGwA2048vs2IY020Ec7CjxVAFwI0_Jrv_JF4l8cAvFVAK0II2c7xJM28C jxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI 8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYx C7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWU JVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRiDGYDUUUUU= = X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: AF7E0140005 X-Rspam-User: X-Stat-Signature: s4q7h6g6bcndnmejs1wg7urkumz5mnpw X-Rspamd-Server: rspam01 X-HE-Tag: 1689663465-596198 X-HE-Meta: U2FsdGVkX1+js7ycaF+rB4SMkd0UQUKrWPUDWC2cx/KYmi+nx59xzRmheFDVz6a8cPjTIgNgMSexh8/1UnCV2H/LLBShiMaZroYBsoREWB2Wojj56RhCLMt6QIBOVMFlliJS64beKyL5KVvZPR5sUWdA611LAEBtshODRdC2aF3hAjdG+Zc+yAjXiofYR4aJ4FBhhrJmtcmFoUeZIlNbFjU9tg8dRVaCme6Vk398zPT+qjVv9A3gS8usFBLWO9es7XFwjqQ9RDpC4AP4dEFFNnQp9gW7oakUBtKwOFUeFE1ZJinI5X1a3rASp8Cah/xPfURgnOAR7goIbyMRpbp6yTzrUuLSklOBpAneAxiqFzn4pedFI45tnDfpM3jWI2Y1uD7mmmSLeUZAlMn/S949JtY3A6U5XQMQCYUP6iTz17LiaG4fkPjBeiQqPUwuQujoF/XrB6ajrEDRXDi01xp/Rk0t1Jl24KrjF846dzNnY7likgRpVOCL3ZtMmdrG8M7zipjSEu7EnkK0m6OPvSydwThMNOaVS0svDnxtem4Hfb9ChGHMbWQxCXdU6SrIImdqQsLgFeq1rUpEZQP0HlC+65zOfUaG6TFGAuB2dq5ZMBdzU9yAsU7DaMPeqnOB+ZNARDAYFrnlvXqRjtzHuKk6Ia4TgkJkn+NviP4hWP2oziVbmmZexR0GoaHVKBy1EvkDQLuCB/WR43YTQ5atH6V9V3s85HGasn9bdkOVbMUug7E6yrRdbTGkOoi0QKSJFUlC/XlnrJ4STl3V0M+8gQPjeVZ07Ld2LHlMCMs9JEdt4hVhP+EyQs8Nrt4A0hpcYoUXC6FYyCM+X08SKqBBk5qGSZs+hFrZ6sxP+YLesPDGLtmP/fxury7kzePsz+kl2ak+a5eyzH1bB8SbGVPsvZbCSqMuy2rSMmHNB81Y4QB/oVRoLJCERnvyzKjh6XOpAyXRlF50DnEVm4TK7R/erLF Fc5Ue5yP h0g4VOz3F/HsRhV/8l8xS1p9jbHQRe0bIylYhbGWhlCxPgtL3gb05wSD2bJbWl0fdm9smeu+SmOluEMJcACyBzn8myvM/lq2zFlThMrQ0DJ11PMf84MVTSd5zSUwvFMjFKTPNWxLznEKXnYIKdPcUkLaNz+XGs5v8x0mSDFTLODyHMKVaiT47A6tRalQZXiJYiSG2j6KRvRQryz3BvLgy1whk1/UPZ0sx3551s96B7FxSuNeSfWnTNbcJ2I/JSENluEYVdzzqo4Vfly10fTL1H70yMoEgcYxXTCz9+YiUf5Iy+yupIvG9ERedBQ== 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: Add common page_ext_data function to get client data. This could hide offset which is auto generated in page_ext core and expose the desgin of page_ext data layout. Signed-off-by: Kemeng Shi --- include/linux/page_ext.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h index 8dd21d87e0da..be98564191e6 100644 --- a/include/linux/page_ext.h +++ b/include/linux/page_ext.h @@ -81,6 +81,12 @@ static inline void page_ext_init(void) extern struct page_ext *page_ext_get(struct page *page); extern void page_ext_put(struct page_ext *page_ext); +static inline void *page_ext_data(struct page_ext *page_ext, + struct page_ext_operations *ops) +{ + return (void *)(page_ext) + ops->offset; +} + static inline struct page_ext *page_ext_next(struct page_ext *curr) { void *next = curr; From patchwork Tue Jul 18 14:58:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kemeng Shi X-Patchwork-Id: 13316793 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A5F6EB64DC for ; Tue, 18 Jul 2023 06:57:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9AA066B0071; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95BC18D0002; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64DF86B0075; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 491166B0071 for ; Tue, 18 Jul 2023 02:57:49 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0AE028017F for ; Tue, 18 Jul 2023 06:57:49 +0000 (UTC) X-FDA: 81023827458.13.B9AE4E3 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by imf21.hostedemail.com (Postfix) with ESMTP id D78FE1C0018 for ; Tue, 18 Jul 2023 06:57:45 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=none; spf=none (imf21.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689663466; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sErK/zzfvdIFYhPMJ9aozjY0f/ReKhUONXFMjb3/TYM=; b=6WHLH0GfO6PxT1k163pCfSdWanuNcSRdh2qXKQHtt8IfMp4qiasxoJIfsVyiWgzCtNaOs2 ZICgaNJhcsqC2WKCViDZMicO6r+EXJ8QItE2AY/1F/nVzoJ+nF6NMN8cTu7RNteS+br93v OmsEGUT8vZDkIiioF1/HT7kkWOG2B6E= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=none; spf=none (imf21.hostedemail.com: domain of shikemeng@huaweicloud.com has no SPF policy when checking 45.249.212.51) smtp.mailfrom=shikemeng@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689663466; a=rsa-sha256; cv=none; b=OaxCbEBofUgHC4WD3U0k16tp2BFlKK7jX6Q+FiX2soz0JzyRSl4qkPVi9oqrqdlXIEswOf 5U4wq0QPDyn8s63/VwgXlRqmWN9enWIzrbVaPl48a12EG1ZTXLxWvL0QlQe/Kjrwkth/Y6 uSTpsY6ZlEFWPqgvm7bFDaIUnkMNd70= Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4R4qX108t6z4f3tnB for ; Tue, 18 Jul 2023 14:57:37 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgB3a+nfN7Zk36ikOA--.34217S4; Tue, 18 Jul 2023 14:57:37 +0800 (CST) From: Kemeng Shi To: akpm@linux-foundation.org, pasha.tatashin@soleen.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: shikemeng@huaweicloud.com Subject: [PATCH 2/3] mm/page_ext: use page_ext_data helper in page_table_check Date: Tue, 18 Jul 2023 22:58:11 +0800 Message-Id: <20230718145812.1991717-3-shikemeng@huaweicloud.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230718145812.1991717-1-shikemeng@huaweicloud.com> References: <20230718145812.1991717-1-shikemeng@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: Syh0CgB3a+nfN7Zk36ikOA--.34217S4 X-Coremail-Antispam: 1UD129KBjvdXoWrtr13Cr17KF4UZr13XFy3twb_yoW3Jrb_t3 42qwn8Xr9YqFyYyrnrC3s7JrWUK3409F45Xr18Kr90vr4rWr4kZa48X3ZI9rWkXryjqFyk urZ5XFnxCr47ZjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb6AFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUXwA2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28C jxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI 8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E 87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64 kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm 72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYx C7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_ Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x 0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8 JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIx AIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sREO6pDUUUUU= = X-CM-SenderInfo: 5vklyvpphqwq5kxd4v5lfo033gof0z/ X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: D78FE1C0018 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: f3rzgmfeae7f1wth76ks55twsjb6sqmh X-HE-Tag: 1689663465-961426 X-HE-Meta: U2FsdGVkX1+LOoYu8zIl/ZHSRx2YPf2I8KZEpOqnlhNVMM0pTiG8BAOF1vKJlg7sJzzdqrDE35/uh+M+FtzTs6CkCiahceveh3NjG17LPWqK1pmIgQg48Fw0B5E8tTNm76O0z8NvfdOfaAzxK9R+8q1lV4loDpx12Qgs6KbgTFbcsTsIIhVAenHvN8VR4yk9iffEgp0967ztfkwb/IlKtGCsJSjZML3IRv59foyolUqUGzs+r6wbdyDSN8U5r0W3xX7cxTNPi0zxd7sl/7RygMY9CMtt+PMqGiUbPEQoNxoe8DFDC4jXVs8BaMfi0c5Xd6EG+3uA8Lkz1dnU8aq3alzqjpwS3TeGkSpYIDKh94B/+DTLnnzSP4t/X2Z1cbfgG/PAvvO3wsYBd5CMWIZaNJy4ige3zSxf5KG/Wm1+u3/HtPvKHfQ4i7oCRFaoCF5Mcwfmw8FhzPC67R7r9bbz36LvoZpeGyQmEyfjVTDfj19zEHBxcoX30dmp09BwoifPn2s5y2xgDgf6bbY3AGNIu0VQDN3u569+NgzMGcIqIU+qz+C+DUJvCpYXLt85C+lLxuJIlAC+vsQw19Gk6aVfwo79RDUwzuFwVlKh0d09SbswiKiUkTBkW7QIKtwEEoVqRy1Y+elJK1EJKVa50rR4E8L7NCLFZolyXQLzBvVoo5Bea01vNW+wRN2cx+4me9F5rr6P8H5fkJOJ8E+SFzOOdKUIao/dUYkm4BXIlG2TSDfszJN/rMEkQ/oz3Bau+PewmYtMjwPBReO2HRHicNM1u3I6+/u0ShjLVY96CWY1uZ1FkXnqcg42wWRxSQTjxrLIYq/pjkyRbDWHEhE/inxK0k4bfoTCCLl7JZ730SXefarbz6AzUGPefTO0lq+73YXejE77ql7iv9JkBFxVHvNq76FihPP9uBChTlTAvY53i5v3UcMQGdEEUDM9YhDKeSZj6wDVzjq7LTRQgB40mnF OUFoNW8w Tsdgs+4QbXwCXR+s2X5+reZmLU6JnmoRryh9kO03r/Ltgw80hU8j0IF3BgjgdFitElajRuLllFw8mTGtrfH6tA/AkBGM89Il7dTnSlm0pH9Nf6XeCm25y46g/iStR3wVsbCOI/F7aYWAbDs8N50AAwxQH2iA8Iqa4rUzCxd+miZYtzOKy4sC2oi60yn0bhqiaIHA84AQGVBm530I0fcb76X58BUUhOBKmdP6dHWvco4qrWf3NdPKl/dae+hg90k6VMicsmJpCPCVBRYZlUWVZKgq7BMnzrxUKwwPpzXZDGC0qHvNhpc3HCFFj5fBDaVsAbWcTQIrjKdZzHxZ3Mefb+XNm3w== 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: use page_ext_data helper in page_table_check to avoid access offset directly. Signed-off-by: Kemeng Shi --- mm/page_table_check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 84c8163984e5..46e77c12c81e 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -51,7 +51,7 @@ struct page_ext_operations page_table_check_ops = { static struct page_table_check *get_page_table_check(struct page_ext *page_ext) { BUG_ON(!page_ext); - return (void *)(page_ext) + page_table_check_ops.offset; + return page_ext_data(page_ext, &page_table_check_ops); } /*