Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699828 > unrolled thread

[PATCH] staging: pi433: reduce stack size in tx thread

Started byArnd Bergmann <arnd@arndb.de>
First post2017-07-31 11:00 +0200
Last post2017-08-02 10:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: pi433: reduce stack size in tx thread Arnd Bergmann <arnd@arndb.de> - 2017-07-31 11:00 +0200
    Re: [PATCH] staging: pi433: reduce stack size in tx thread "Wolf Entwicklungen" <Marcus.Wolf@Wolf-Entwicklungen.de> - 2017-08-02 10:30 +0200

#1699828 — [PATCH] staging: pi433: reduce stack size in tx thread

FromArnd Bergmann <arnd@arndb.de>
Date2017-07-31 11:00 +0200
Subject[PATCH] staging: pi433: reduce stack size in tx thread
Message-ID<u9eIp-44A-5@gated-at.bofh.it>
Putting a 900 byte array on the stack is a clearly too much in the
kernel, and sometimes results in warnings like:

drivers/staging/pi433/pi433_if.c: In function 'pi433_tx_thread':
drivers/staging/pi433/pi433_if.c:645:1: error: the frame size of 1028 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

This moves the buffer into the dynamically allocated per-device
structure.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/pi433/pi433_if.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index ed737f4b1e77..ec9811ae4735 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -92,6 +92,7 @@ struct pi433_device {
 	struct task_struct	*tx_task_struct;
 	wait_queue_head_t	tx_wait_queue;
 	u8			free_in_fifo;
+	char			buffer[MAX_MSG_SIZE];
 
 	/* rx related values */
 	struct pi433_rx_cfg	rx_cfg;
@@ -471,7 +472,7 @@ pi433_tx_thread(void *data)
 	struct pi433_device *device = data;
 	struct spi_device *spi = device->spi; /* needed for SET_CHECKED */
 	struct pi433_tx_cfg tx_cfg;
-	u8     buffer[MAX_MSG_SIZE];
+	u8     *buffer = device->buffer;
 	size_t size;
 	bool   rx_interrupted = false;
 	int    position, repetitions;
-- 
2.9.0

[toc] | [next] | [standalone]


#1701853

From"Wolf Entwicklungen" <Marcus.Wolf@Wolf-Entwicklungen.de>
Date2017-08-02 10:30 +0200
Message-ID<u9Xct-7q1-9@gated-at.bofh.it>
In reply to#1699828
Reviewed-by: Marcus Wolf <linux@wolf-entwicklungen.de>

Maybe tx_buffer is a bit more clearly then buffer.

Thanks,

Marcus

Am Mo, 31.07.2017, 10:57 schrieb Arnd Bergmann:
> Putting a 900 byte array on the stack is a clearly too much in the
> kernel, and sometimes results in warnings like:
>
> drivers/staging/pi433/pi433_if.c: In function 'pi433_tx_thread':
> drivers/staging/pi433/pi433_if.c:645:1: error: the frame size of 1028 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
>
> This moves the buffer into the dynamically allocated per-device
> structure.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/staging/pi433/pi433_if.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
> index ed737f4b1e77..ec9811ae4735 100644
> --- a/drivers/staging/pi433/pi433_if.c
> +++ b/drivers/staging/pi433/pi433_if.c
> @@ -92,6 +92,7 @@ struct pi433_device {
>  	struct task_struct	*tx_task_struct;
>  	wait_queue_head_t	tx_wait_queue;
>  	u8			free_in_fifo;
> +	char			buffer[MAX_MSG_SIZE];
>
>  	/* rx related values */
>  	struct pi433_rx_cfg	rx_cfg;
> @@ -471,7 +472,7 @@ pi433_tx_thread(void *data)
>  	struct pi433_device *device = data;
>  	struct spi_device *spi = device->spi; /* needed for SET_CHECKED */
>  	struct pi433_tx_cfg tx_cfg;
> -	u8     buffer[MAX_MSG_SIZE];
> +	u8     *buffer = device->buffer;
>  	size_t size;
>  	bool   rx_interrupted = false;
>  	int    position, repetitions;
> --
> 2.9.0
>
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web