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


Groups > linux.kernel > #1605357 > unrolled thread

[PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

Started by"Pranay Kr. Srivastava" <pranjas@gmail.com>
First post2017-03-21 08:20 +0100
Last post2017-03-24 11:20 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH staging/speakup v3 3/3] use speakup_allocate as per required context "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2017-03-21 08:20 +0100
    Re: [PATCH staging/speakup v3 3/3] use speakup_allocate as per  required context Greg KH <gregkh@linuxfoundation.org> - 2017-03-23 14:20 +0100
      [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context "Pranay Kr. Srivastava" <pranjas@gmail.com> - 2017-03-24 09:40 +0100
        Re: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as  per required context Greg KH <greg@kroah.com> - 2017-03-24 09:50 +0100
          Re: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as  per required context Pranay Srivastava <pranjas@gmail.com> - 2017-03-24 11:20 +0100

#1605357 — [PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

From"Pranay Kr. Srivastava" <pranjas@gmail.com>
Date2017-03-21 08:20 +0100
Subject[PATCH staging/speakup v3 3/3] use speakup_allocate as per required context
Message-ID<tnmff-8tT-3@gated-at.bofh.it>
speakup_allocate used GFP_ATOMIC for allocations
even while during initialization due to it's use
in notifier call.

Pass GFP_ flags as well to speakup_allocate depending
on the context it is called in.

Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
---
 drivers/staging/speakup/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index ca817ca..ede842e 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1327,14 +1327,14 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
 }
 
 /* Allocation concurrency is protected by the console semaphore */
-static int speakup_allocate(struct vc_data *vc)
+static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
 {
 	int vc_num;
 
 	vc_num = vc->vc_num;
 	if (speakup_console[vc_num] == NULL) {
 		speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
-						  GFP_ATOMIC);
+						  gfp_flags);
 		if (speakup_console[vc_num] == NULL)
 			return -ENOMEM;
 		speakup_date(vc);
@@ -2257,7 +2257,7 @@ static int vt_notifier_call(struct notifier_block *nb,
 	switch (code) {
 	case VT_ALLOCATE:
 		if (vc->vc_mode == KD_TEXT)
-			speakup_allocate(vc);
+			speakup_allocate(vc, GFP_ATOMIC);
 		break;
 	case VT_DEALLOCATE:
 		speakup_deallocate(vc);
@@ -2343,7 +2343,7 @@ static int __init speakup_init(void)
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++)
 		if (vc_cons[i].d) {
-			err = speakup_allocate(vc_cons[i].d);
+			err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
 			if (err)
 				goto error_kobjects;
 		}
-- 
2.10.2

[toc] | [next] | [standalone]


#1607483 — Re: [PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

FromGreg KH <gregkh@linuxfoundation.org>
Date2017-03-23 14:20 +0100
SubjectRe: [PATCH staging/speakup v3 3/3] use speakup_allocate as per required context
Message-ID<toaOK-2Hz-37@gated-at.bofh.it>
In reply to#1605357
On Tue, Mar 21, 2017 at 12:40:24PM +0530, Pranay Kr. Srivastava wrote:
> speakup_allocate used GFP_ATOMIC for allocations
> even while during initialization due to it's use
> in notifier call.
> 
> Pass GFP_ flags as well to speakup_allocate depending
> on the context it is called in.
> 
> Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
> ---
>  drivers/staging/speakup/main.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

This patch didn't apply to my staging-testing branch, but the 2 others
did, odd.  Can you rebase it and resend?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1608220 — [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

From"Pranay Kr. Srivastava" <pranjas@gmail.com>
Date2017-03-24 09:40 +0100
Subject[[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context
Message-ID<tosVk-7gO-23@gated-at.bofh.it>
In reply to#1607483
speakup_allocate used GFP_ATOMIC for allocations
even while during initialization due to it's use
in notifier call.

Pass GFP_ flags as well to speakup_allocate depending
on the context it is called in.

Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
---
 drivers/staging/speakup/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 2db3f06..b811c86 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1341,14 +1341,14 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
 }
 
 /* Allocation concurrency is protected by the console semaphore */
-static int speakup_allocate(struct vc_data *vc)
+static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
 {
 	int vc_num;
 
 	vc_num = vc->vc_num;
 	if (speakup_console[vc_num] == NULL) {
 		speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
-						  GFP_ATOMIC);
+						  gfp_flags);
 		if (!speakup_console[vc_num])
 			return -ENOMEM;
 		speakup_date(vc);
@@ -2277,7 +2277,7 @@ static int vt_notifier_call(struct notifier_block *nb,
 	switch (code) {
 	case VT_ALLOCATE:
 		if (vc->vc_mode == KD_TEXT)
-			speakup_allocate(vc);
+			speakup_allocate(vc, GFP_ATOMIC);
 		break;
 	case VT_DEALLOCATE:
 		speakup_deallocate(vc);
@@ -2362,7 +2362,7 @@ static int __init speakup_init(void)
 
 	for (i = 0; i < MAX_NR_CONSOLES; i++)
 		if (vc_cons[i].d) {
-			err = speakup_allocate(vc_cons[i].d);
+			err = speakup_allocate(vc_cons[i].d, GFP_KERNEL);
 			if (err)
 				goto error_kobjects;
 		}
-- 
2.10.2

[toc] | [prev] | [next] | [standalone]


#1608227 — Re: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

FromGreg KH <greg@kroah.com>
Date2017-03-24 09:50 +0100
SubjectRe: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context
Message-ID<tot50-7ku-29@gated-at.bofh.it>
In reply to#1608220
On Fri, Mar 24, 2017 at 02:07:11PM +0530, Pranay Kr. Srivastava wrote:
> speakup_allocate used GFP_ATOMIC for allocations
> even while during initialization due to it's use
> in notifier call.

Is that a problem?

> Pass GFP_ flags as well to speakup_allocate depending
> on the context it is called in.

At init, we should be fine to use GFP_ATOMIC, so is this change really
needed?

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1608292 — Re: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context

FromPranay Srivastava <pranjas@gmail.com>
Date2017-03-24 11:20 +0100
SubjectRe: [[RESEND]PATCH staging/speakup v3 3/3] use speakup_allocate as per required context
Message-ID<touu5-8u8-5@gated-at.bofh.it>
In reply to#1608227
On Fri, Mar 24, 2017 at 2:13 PM, Greg KH <greg@kroah.com> wrote:
> On Fri, Mar 24, 2017 at 02:07:11PM +0530, Pranay Kr. Srivastava wrote:
>> speakup_allocate used GFP_ATOMIC for allocations
>> even while during initialization due to it's use
>> in notifier call.
>
> Is that a problem?

No that's the way it should be. I was just trying to say that allocation
should be context based[?]. If we can be lenient then that's better[?]

>
>> Pass GFP_ flags as well to speakup_allocate depending
>> on the context it is called in.
>
> At init, we should be fine to use GFP_ATOMIC, so is this change really
> needed?
>
> thanks,
>
> greg k-h



-- 
        ---P.K.S

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web