From patchwork Thu Dec 23 08:57:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guoqing Jiang X-Patchwork-Id: 12698051 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 E245CC433F5 for ; Thu, 23 Dec 2021 08:57:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 514E66B0073; Thu, 23 Dec 2021 03:57:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C5496B0074; Thu, 23 Dec 2021 03:57:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B3B46B0075; Thu, 23 Dec 2021 03:57:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0220.hostedemail.com [216.40.44.220]) by kanga.kvack.org (Postfix) with ESMTP id 2D7E16B0073 for ; Thu, 23 Dec 2021 03:57:40 -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 E8E6C8A3D9 for ; Thu, 23 Dec 2021 08:57:39 +0000 (UTC) X-FDA: 78948455838.01.5911275 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf08.hostedemail.com (Postfix) with ESMTP id 2626A160023 for ; Thu, 23 Dec 2021 08:57:32 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1640249857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=2NwBTJ3haF6NXIGe4nqL4UnxCmof/INj+/5Jb6b1hEg=; b=rgpqm4UEk9KSsLolgeUrvTnIQBndClDCR0kS+4VeD78P5k3XgmKV+DYtbbrYm+TZgwUzCw g9ID8iKhNj6x1cbB33Ko22zpAs+uyCa7+u/oDOmzVWtCAkbdM0MEOgJ6e2tZwOQNe0DWaZ fil1Ldl3rOptK0xStTlQh9cNs8P4Wsg= From: Guoqing Jiang To: sj@kernel.org, akpm@linux-foundation.org Cc: linux-mm@kvack.org, Guoqing Jiang Subject: [PATCH] mm/damon: move the implementation of damon_insert_region to damon.h Date: Thu, 23 Dec 2021 16:57:03 +0800 Message-Id: <20211223085703.6142-1-guoqing.jiang@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Queue-Id: 2626A160023 X-Stat-Signature: xuuwu1w7epcnrryu7a6dr8oh7reho464 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=rgpqm4UE; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf08.hostedemail.com: domain of guoqing.jiang@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=guoqing.jiang@linux.dev X-Rspamd-Server: rspam02 X-HE-Tag: 1640249852-28501 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: Usually, inline function is declared static since it should sit between storage and type. And implement it in a header file if used by multiple files. And this change also fixes compile issue when backport damon to 5.10. mm/damon/vaddr.c: In function ‘damon_va_evenly_split_region’: ./include/linux/damon.h:425:13: error: inlining failed in call to ‘always_inline’ ‘damon_insert_region’: function body not available 425 | inline void damon_insert_region(struct damon_region *r, | ^~~~~~~~~~~~~~~~~~~ mm/damon/vaddr.c:86:3: note: called from here 86 | damon_insert_region(n, r, next, t); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Guoqing Jiang Reviewed-by: SeongJae Park --- include/linux/damon.h | 13 +++++++++++-- mm/damon/core.c | 11 ----------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index b4d4be3cc987..c0b03a8ef0d7 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -422,9 +422,18 @@ struct damon_ctx { #ifdef CONFIG_DAMON struct damon_region *damon_new_region(unsigned long start, unsigned long end); -inline void damon_insert_region(struct damon_region *r, + +/* + * Add a region between two other regions + */ +static inline void damon_insert_region(struct damon_region *r, struct damon_region *prev, struct damon_region *next, - struct damon_target *t); + struct damon_target *t) +{ + __list_add(&r->list, &prev->list, &next->list); + t->nr_regions++; +} + void damon_add_region(struct damon_region *r, struct damon_target *t); void damon_destroy_region(struct damon_region *r, struct damon_target *t); diff --git a/mm/damon/core.c b/mm/damon/core.c index e92497895202..01f6347385b4 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -53,17 +53,6 @@ struct damon_region *damon_new_region(unsigned long start, unsigned long end) return region; } -/* - * Add a region between two other regions - */ -inline void damon_insert_region(struct damon_region *r, - struct damon_region *prev, struct damon_region *next, - struct damon_target *t) -{ - __list_add(&r->list, &prev->list, &next->list); - t->nr_regions++; -} - void damon_add_region(struct damon_region *r, struct damon_target *t) { list_add_tail(&r->list, &t->regions_list);