[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMz4kuKQKMg6KQx0reXmw_J9e1abW2f93dPnNwxgM4ouegU8gQ@mail.gmail.com>
Date: Wed, 18 Nov 2015 20:45:45 +0800
From: Baolin Wang <baolin.wang@...aro.org>
To: David Laight <David.Laight@...lab.com>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"r.baldyga@...sung.com" <r.baldyga@...sung.com>,
"fabio.estevam@...escale.com" <fabio.estevam@...escale.com>,
Philip Oberstaller <Philip.Oberstaller@...tentrio.com>,
Peter Hurley <peter@...leysoftware.com>,
"scottwood@...escale.com" <scottwood@...escale.com>,
Mark Brown <broonie@...nel.org>,
USB <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: gadget: Add the console support for usb-to-serial port
On 18 November 2015 at 20:05, David Laight <David.Laight@...lab.com> wrote:
> From: Baolin Wang
>> Sent: 18 November 2015 10:45
>> On 18 November 2015 at 17:32, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
>> > On Wed, Nov 18, 2015 at 4:15 AM, Baolin Wang <baolin.wang@...aro.org> wrote:
>> >> On 17 November 2015 at 21:34, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
>> >>> On Mon, Nov 16, 2015 at 9:05 AM, Baolin Wang <baolin.wang@...aro.org> wrote:
>> >>>> It dose not work when we want to use the usb-to-serial port based
>> >>>> on one usb gadget as a console. Thus this patch adds the console
>> >>>> initialization to support this request.
>> >>>
>> >
>> >>>> +#define GS_BUFFER_SIZE (4096)
>> >>> Redundant parens
>> >> OK. I'll remove it.
>> >>
>> >>>> +#define GS_CONSOLE_BUF_SIZE (2 * GS_BUFFER_SIZE)
>> >>>> +
>> >>>> +struct gscons_info {
>> >>>> + struct gs_port *port;
>> >>>> + struct tty_driver *tty_driver;
>> >>>> + struct work_struct work;
>> >>>> + int buf_tail;
>> >>>> + char buf[GS_CONSOLE_BUF_SIZE];
>> >>>
>> >>> Can't be malloced once?
>> >> The 'gscons_info' structure is malloced once.
>> >
>> > In state of high fragmentation is quite hard to find big memory chunks.
>> > I would split it to two allocations, though if maintainers are okay
>> > with your code, then I'm also okay.
>> >
>>
>> Make sense. But I think the major memory of the 'struct gscons_info'
>> is for the 'buf' member, so I still think no need to allocate it 2
>> times.
>
> It may be worth just reducing GS_BUFFER_SIZE slightly so that the gscons_info
> structure itself is less than 8k.
> If you can't get 2 adjacent pages then a lot of things will fail.
>
But its allocation is called in early booting time, I think there are
not many memory fragments now.
> David
>
--
Baolin.wang
Best Regards
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists