Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1891500ybh; Thu, 23 Jul 2020 22:07:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmRnn/GKuckEa0Axz4qpQZFtDsKddDBiW0VReYf3v0MVgJ3NexUa4wpDUl1x4MK5/vo3+A X-Received: by 2002:aa7:c31a:: with SMTP id l26mr7022157edq.61.1595567276310; Thu, 23 Jul 2020 22:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595567276; cv=none; d=google.com; s=arc-20160816; b=Xary/hhxVCoyyYpFHD/ljB/gEXy8WHeonJe3yA8Pi8fzJk4JG9IE/NRjfVCpTDkKig rTB/80WxBDe3ODWW1udboQFco4S9FmMARHLB5ppHg84G7GWdfSgdHiYoewVFUxYN1zYX bkn1PAiaWe7RUbjho4mhIZ0xW97Z2vtXXZYwwPAq3JnEH5x204xQnkILZUGcZVHnYNmx k1P2OOrkGqVnf1OoF1zzzz9/uhb6cpHcLn7u3/sOiae2WnNBSReUKhqphnh2FyW1Qy+R 5C7bKXuc+SIucVs13qAtNdPCnb+lGw43rZ2efsigb/2bcZe2wbPmdzsnHx5RiVXCRyfG jEVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=yIraIApFjJkPdR4vqskXRLJimz4J4RxIEudRWHHL+jg=; b=s9qXc46w8rc8HtwKP8Jjf7H/hTiDjmKdC6+cK/Etk9IgPnmvRc6o61NTMpCx3W2xLe veYsgBF+UtZ6sCpF5jaRIlbr9PqkFpxpVlM3lyeJdFgv3Eq3DdxcpOyZWrfQZwwfnThr IKVspq3qly6mDMWYqnKuvdSx70mauOUo69GDT/VqwIL9C6lmS4pNvaILsEAnLROKXaUZ lDmdCxMQlA9V+DFXl8+Vs4Z+9iDqhANsLrerAJz2DAaMcGws0XgftAFrN1oSzyf1xgBm UP38egYmfRHL+qBpy3U5fPgqWZ2T5mHTwGdhDPZ7Qc4y3aot3njduBb3XIctm0VjcyKX eh+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si3272832edm.463.2020.07.23.22.07.34; Thu, 23 Jul 2020 22:07:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbgGXFGj (ORCPT + 99 others); Fri, 24 Jul 2020 01:06:39 -0400 Received: from mga09.intel.com ([134.134.136.24]:62116 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725929AbgGXFGi (ORCPT ); Fri, 24 Jul 2020 01:06:38 -0400 IronPort-SDR: zoWxoue24zaIdgmfZeN3BniqhlRwrW3bP547jdW5OXtr9FKXcQLva6wG4M91SKbdLDGz0as8SL M7ogvcK3X4EQ== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="151951863" X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="151951863" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jul 2020 22:06:38 -0700 IronPort-SDR: Y745JBr6aV5Cuf4jsX3nKNPk6MjsigD/X68qgg7p4Wds3octHlH+g1sNv9NhVt3hjgBoYUFMjd TFgDaLoCIY0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,389,1589266800"; d="scan'208";a="432970205" Received: from itopinsk-mobl1.ccr.corp.intel.com (HELO localhost) ([10.249.36.179]) by orsmga004.jf.intel.com with ESMTP; 23 Jul 2020 22:06:34 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org Cc: Jarkko Sakkinen , linux-mm@kvack.org, Andi Kleen , Masami Hiramatsu , Peter Zijlstra , "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" Subject: [PATCH v5 5/6] kprobes: Use text_alloc() and text_free() Date: Fri, 24 Jul 2020 08:05:52 +0300 Message-Id: <20200724050553.1724168-6-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> References: <20200724050553.1724168-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use text_alloc() and text_free() instead of module_alloc() and module_memfree() when an arch provides them. Cc: linux-mm@kvack.org Cc: Andi Kleen Cc: Masami Hiramatsu Cc: Peter Zijlstra Signed-off-by: Jarkko Sakkinen --- kernel/kprobes.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 4e46d96d4e16..611fcda9f6bf 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -40,6 +40,7 @@ #include #include #include +#include #define KPROBE_HASH_BITS 6 #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS) @@ -111,12 +112,20 @@ enum kprobe_slot_state { void __weak *alloc_insn_page(void) { +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC + return text_alloc(PAGE_SIZE); +#else return module_alloc(PAGE_SIZE); +#endif } void __weak free_insn_page(void *page) { +#ifdef CONFIG_ARCH_HAS_TEXT_ALLOC + text_free(page); +#else module_memfree(page); +#endif } struct kprobe_insn_cache kprobe_insn_slots = { -- 2.25.1