* [PATCH] fbcon: use kvmalloc() for scrollback buffer
@ 2018-11-26 10:02 ` Konstantin Khorenko
2018-12-20 16:21 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Khorenko @ 2018-11-26 10:02 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz
Cc: Konstantin Khorenko, linux-fbdev, linux-kernel, dri-devel
Scrollback frame buffer is rather big - 32K,
so it requires 3rd order page, so let's use kvmalloc() instead of
ordinary kmalloc() for it.
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
drivers/video/fbdev/core/fbcon.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 8958ccc8b1ac..2b1a34d3f5e2 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -992,7 +992,7 @@ static const char *fbcon_startup(void)
if (!softback_buf) {
softback_buf =
(unsigned long)
- kmalloc(fbcon_softback_size,
+ kvmalloc(fbcon_softback_size,
GFP_KERNEL);
if (!softback_buf) {
fbcon_softback_size = 0;
@@ -1001,7 +1001,7 @@ static const char *fbcon_startup(void)
}
} else {
if (softback_buf) {
- kfree((void *) softback_buf);
+ kvfree((void *) softback_buf);
softback_buf = 0;
softback_top = 0;
}
@@ -3665,7 +3665,7 @@ static void fbcon_exit(void)
}
#endif
- kfree((void *)softback_buf);
+ kvfree((void *)softback_buf);
softback_buf = 0UL;
for_each_registered_fb(i) {
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fbcon: use kvmalloc() for scrollback buffer
2018-11-26 10:02 ` [PATCH] fbcon: use kvmalloc() for scrollback buffer Konstantin Khorenko
@ 2018-12-20 16:21 ` Bartlomiej Zolnierkiewicz
2018-12-21 10:58 ` Konstantin Khorenko
0 siblings, 1 reply; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-12-20 16:21 UTC (permalink / raw)
To: Konstantin Khorenko; +Cc: linux-fbdev, linux-kernel, dri-devel
Hi,
On 11/26/2018 11:02 AM, Konstantin Khorenko wrote:
> Scrollback frame buffer is rather big - 32K,
> so it requires 3rd order page, so let's use kvmalloc() instead of
> ordinary kmalloc() for it.
Is it actually safe to use non-contiguous memory for softback_buf?
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> drivers/video/fbdev/core/fbcon.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index 8958ccc8b1ac..2b1a34d3f5e2 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -992,7 +992,7 @@ static const char *fbcon_startup(void)
> if (!softback_buf) {
> softback_buf =
> (unsigned long)
> - kmalloc(fbcon_softback_size,
> + kvmalloc(fbcon_softback_size,
> GFP_KERNEL);
> if (!softback_buf) {
> fbcon_softback_size = 0;
> @@ -1001,7 +1001,7 @@ static const char *fbcon_startup(void)
> }
> } else {
> if (softback_buf) {
> - kfree((void *) softback_buf);
> + kvfree((void *) softback_buf);
> softback_buf = 0;
> softback_top = 0;
> }
> @@ -3665,7 +3665,7 @@ static void fbcon_exit(void)
> }
> #endif
>
> - kfree((void *)softback_buf);
> + kvfree((void *)softback_buf);
> softback_buf = 0UL;
>
> for_each_registered_fb(i) {
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fbcon: use kvmalloc() for scrollback buffer
2018-12-20 16:21 ` Bartlomiej Zolnierkiewicz
@ 2018-12-21 10:58 ` Konstantin Khorenko
2019-02-08 17:02 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 4+ messages in thread
From: Konstantin Khorenko @ 2018-12-21 10:58 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz; +Cc: linux-fbdev, linux-kernel, dri-devel
Hi Bartlomiej,
On 12/20/2018 07:21 PM, Bartlomiej Zolnierkiewicz wrote:
> On 11/26/2018 11:02 AM, Konstantin Khorenko wrote:
>> Scrollback frame buffer is rather big - 32K,
>> so it requires 3rd order page, so let's use kvmalloc() instead of
>> ordinary kmalloc() for it.
>
> Is it actually safe to use non-contiguous memory for softback_buf?
Well, that's why we need a review. :)
i've asked myself same question while fixing this,
i've dig sources a bit and did not find places when softback_buf is provided for DMA,
all other places seems to work with virtual addresses, so there should be no problem.
Even more i saw a function which mentions that softback might be non-contigious:
/* As we might be inside of softback, we may work with non-contiguous buffer,
that's why we have to use a separate routine. */
static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt)
So i think it's safe to use kvmalloc() here.
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
>> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
>> ---
>> drivers/video/fbdev/core/fbcon.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
>> index 8958ccc8b1ac..2b1a34d3f5e2 100644
>> --- a/drivers/video/fbdev/core/fbcon.c
>> +++ b/drivers/video/fbdev/core/fbcon.c
>> @@ -992,7 +992,7 @@ static const char *fbcon_startup(void)
>> if (!softback_buf) {
>> softback_buf =
>> (unsigned long)
>> - kmalloc(fbcon_softback_size,
>> + kvmalloc(fbcon_softback_size,
>> GFP_KERNEL);
>> if (!softback_buf) {
>> fbcon_softback_size = 0;
>> @@ -1001,7 +1001,7 @@ static const char *fbcon_startup(void)
>> }
>> } else {
>> if (softback_buf) {
>> - kfree((void *) softback_buf);
>> + kvfree((void *) softback_buf);
>> softback_buf = 0;
>> softback_top = 0;
>> }
>> @@ -3665,7 +3665,7 @@ static void fbcon_exit(void)
>> }
>> #endif
>>
>> - kfree((void *)softback_buf);
>> + kvfree((void *)softback_buf);
>> softback_buf = 0UL;
>>
>> for_each_registered_fb(i) {
>
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fbcon: use kvmalloc() for scrollback buffer
2018-12-21 10:58 ` Konstantin Khorenko
@ 2019-02-08 17:02 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 4+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-02-08 17:02 UTC (permalink / raw)
To: Konstantin Khorenko; +Cc: linux-fbdev, linux-kernel, dri-devel
On 12/21/2018 11:58 AM, Konstantin Khorenko wrote:
> Hi Bartlomiej,
>
> On 12/20/2018 07:21 PM, Bartlomiej Zolnierkiewicz wrote:
>> On 11/26/2018 11:02 AM, Konstantin Khorenko wrote:
>>> Scrollback frame buffer is rather big - 32K,
>>> so it requires 3rd order page, so let's use kvmalloc() instead of
>>> ordinary kmalloc() for it.
>>
>> Is it actually safe to use non-contiguous memory for softback_buf?
>
> Well, that's why we need a review. :)
:)
> i've asked myself same question while fixing this,
> i've dig sources a bit and did not find places when softback_buf is provided for DMA,
> all other places seems to work with virtual addresses, so there should be no problem.
>
> Even more i saw a function which mentions that softback might be non-contigious:
>
> /* As we might be inside of softback, we may work with non-contiguous buffer,
> that's why we have to use a separate routine. */
> static void fbcon_invert_region(struct vc_data *vc, u16 * p, int cnt)
>
> So i think it's safe to use kvmalloc() here.
Patch queued for v5.1, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-08 17:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20181126100342epcas3p12a1e6505ff4b73375ac3fcf5d0355d3f@epcas3p1.samsung.com>
2018-11-26 10:02 ` [PATCH] fbcon: use kvmalloc() for scrollback buffer Konstantin Khorenko
2018-12-20 16:21 ` Bartlomiej Zolnierkiewicz
2018-12-21 10:58 ` Konstantin Khorenko
2019-02-08 17:02 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).