Bringing Android closer to the mainline
Tim Bird recently announced the existence of the Android mainlining project, an effort intended to help coordinate the various groups that have been working in this area. The project has the obligatory wiki and mailing list. The list is new and has not seen a whole lot of traffic - a situation which may well change in the near future.
Toward the end of November, the core Android code was returned to the staging tree, from which it had been removed at the end of 2009. Since the code's return to staging, changes have been going in and the code has caught up to its state in the Android tree. The code has now reached a point where, as summarized by Greg Kroah-Hartman on December 16:
Between the wiki and a look at drivers/staging/android in linux-next, one can get a fair idea of the state of the various patches. One notable patch that is not there is wakelocks (or "suspend blockers"), a feature which has been at the core of the controversy around the Android code. The wakelock concept will almost certainly return at some point, but much of the focus seems to be on the easier components at the moment. As Greg noted, wakelocks are not actually needed to boot an Android system - they're just necessary to keep that system from draining the battery too quickly.
The pieces that exist in the linux-next staging directory now are:
- Binder, the
interprocess communication mechanism used within Android. Binder
could conceivably be replaced with a standard IPC mechanism or,
perhaps, with D-bus, but it has a number of unique features (zero-copy
message transmission, thread management, credential passing) that are
hard to replace in a straightforward manner. (See this article for a detailed look at
various Linux IPC mechanisms, binder included).
- Logger is the kernel piece of the Android logging
system. It implements a completely separate path for
Android-specific log
messages, which do not mix with normal kernel messages in any way.
Other than adding a "facility" concept to kernel logging, it's not
clear what this component offers, but it is also relatively
self-contained and should not be too controversial.
- The "low memory killer" implements Android's interesting approach to
application management. In the Android world, applications never
choose to exit. They hang around until memory gets tight, at which
point kernel starts to kill them off. It's a
small piece of code that works using the "shrinker"
mechanism, a standard way to register functions to be called when the
kernel would like to free up some memory. So, even though it is
memory-management code, it is
relatively unintrusive and will not affect systems where it is not
used.
- "Pmem" is Android's answer to the age-old problem of allocating large,
physically-contiguous buffers after the system has been running for a
while. It works in the usual way: a range of memory is set aside at
boot time. One difference with pmem is that it exports a device to
user space, allowing buffers to be allocated directly by applications
and passed to drivers. That, in turn, leads to things like camera
drivers being written with the assumption that user space can give
them physically-contiguous buffers for video frames, something that
would not be possible in a mainline kernel.
Approaches like CMA seem like a better solution to this particular problem - if and when CMA is merged into the mainline. Meanwhile, however, applications have been written using pmem, so that interface is unlikely to go away in the near future.
- The "RAM console" saves log data to a special region of memory where
it can be found and recovered after a reboot. It is a debugging tool.
- "Timed GPIO" is a simple mechanism whereby the kernel can schedule a specific setting for a GPIO line at some point in the future. An example use would be to ensure that the vibrator gets turned off regardless of what happens to the application that turned it on.
The "ashmem" component was not in linux-next as of this writing, but, as Greg noted, its arrival there is expected in the near future. Ashmem is a shared memory mechanism that is able to discard some or all of its contents when memory pressure gets high. It could conceivably be replaced by the proposed POSIX_FADV_VOLATILE operation, but the latter does not, yet, seem to be a complete solution for Android's requirements.
There are a number of Android-specific changes that do not appear on that list, and, thus, are not likely to be merged into the mainline in the near future. Some of them are so Android-specific that they may never get in; the "network security" tweaks fall into that category. Others, such as the alarm timer code, may be superseded by enhancements in the mainline. Then, of course, there is a long list of drivers for hardware found on Android devices. Quite a few of those drivers have found their way into the mainline already, and others are on their way.
In summary: if all goes well, the 3.3 kernel should see the delta between
Android kernels and the mainline go down considerably. That should make
life easier for developers and for vendors wanting to provide
Android-compatible hardware. Of course, it would be unsurprising if
Android were to grow new subsystems of its own in the future; the Android
developers have made it clear that they are unable and unwilling to wait
for the mainlining process to run its course when they have products to
ship. But, with any luck at all, the worst days of a significant fork that
has caused a fair amount of ill will and difficult discussion should soon
be behind us.
Index entries for this article | |
---|---|
Kernel | Android |
Posted Dec 20, 2011 22:12 UTC (Tue)
by karim (subscriber, #114)
[Link]
Posted Dec 20, 2011 22:28 UTC (Tue)
by neilbrown (subscriber, #359)
[Link] (8 responses)
Use the "leds-gpio" driver to provide a "/sys/class/leds" interface to the gpio, then:
# cd /sys/class/leds/NAME-OF-LED
and the GPIO will be asserted for one second, then de-asserted for approximately one fortnight - which should be long enough for user-space to turn it off properly.
So this seems to be unnecessary duplication.
Posted Dec 20, 2011 22:58 UTC (Tue)
by alvieboy (guest, #51617)
[Link] (4 responses)
First of all, GPIO bitbanging requires often some precise timing, something that is irrelevant to LED and other "human display-only" interfaces.
Second, GPIO are usually "tristate", meaning that you can program the pin to be left with high-impedance. LED class not only does not implement that, it does not have to implement that at all.
IMHO, GPIO-style pins, on specialized hardware, should have an interface very much like USB has right now. Meaning, to be able to be bound to kernel devices, and to be claimed by userspace, with somehow same rules like those on current USB stack.
Alvie
Posted Dec 20, 2011 23:18 UTC (Tue)
by neilbrown (subscriber, #359)
[Link] (2 responses)
In the example use-case of turning a vibrator off, it seems very similar to a LED. There may be other use-cases that I'm not aware of of course. If you wanted a timed GPIO for bit-banging you wouldn't use a LED device. Maybe an SPI device or an I2C device?
GPIO pins can be exported to user-space, and then can be controlled by setting the direction, the value, and the edges on which an interrupt it triggered. The interrupt can be sensed by using 'poll' on the relevant sysfs file.
gpiolib provides "gpio_export" which will export a given gpio, and it appears as e.g. /sys/class/gpio/gpio47/{value,direction,....}
I agree that it can be very useful to export raw gpios to user-space, but where possible I think it is best to hide them behind some higher-level abstraction, such as LED.
Posted Dec 21, 2011 7:25 UTC (Wed)
by hrw (subscriber, #44826)
[Link] (1 responses)
Posted Jan 6, 2012 19:14 UTC (Fri)
by navaati (guest, #82114)
[Link]
Posted Dec 21, 2011 6:12 UTC (Wed)
by neilbrown (subscriber, #359)
[Link]
There are really two things here: a "timed_output" class, and a "timed_gpio" driver that creates a "timed_output" device that drives a GPIO.
The "timed_output" class provides a single device attribute: "enable". It leaves the interpretation of that value to the driver.
Writing "0" de-asserts the gpio. Writing a number of milliseconds causes the gpio to be asserted for that long, then de-asserted.
There are two things that timed_gpio provides that leds-gpio currently doesn't.
1/ high precision. leds-gpio uses jiffies-based timers so probably only to the nearest 4msecs. timed_gpio uses hrtimers, so give 1msec precision.
2/ read back of time remaining.
The only references to timed_gpio I can find on the web are for using it for the vibrator just like the above article says. I doubt that needs millisecond precision. If it did, a leds-hrgpio driver could be written (or an extension to the current driver) rather than a new class.
If the time-remaining was really important, then a 'one-shot' led-trigger could be written (rather than a whole new class) which reported the time remaining. That might be useful for other leds as well.
"full exploitation" is a good thing!
Posted Dec 21, 2011 1:17 UTC (Wed)
by scottt (guest, #5028)
[Link] (2 responses)
Posted Dec 21, 2011 1:26 UTC (Wed)
by neilbrown (subscriber, #359)
[Link]
Posted Dec 21, 2011 7:30 UTC (Wed)
by ebiederm (subscriber, #35028)
[Link]
Posted Dec 20, 2011 23:31 UTC (Tue)
by leemgs (guest, #24528)
[Link] (27 responses)
Posted Dec 20, 2011 23:33 UTC (Tue)
by corbet (editor, #1)
[Link] (26 responses)
Posted Dec 21, 2011 4:34 UTC (Wed)
by leemgs (guest, #24528)
[Link]
"Note, this does not include the wakelock code, that is being worked
Posted Dec 21, 2011 5:06 UTC (Wed)
by brendan_wright (guest, #7376)
[Link] (24 responses)
Posted Dec 21, 2011 5:47 UTC (Wed)
by dlang (guest, #313)
[Link]
userspace wakelocks can be implemented without needing anything in the kernel.
I actually think that wakelocks are a poor solution to the problem of 'how do you save power', especially when you have things like 'if the screen is lit up, take a wakelock to prevent the machine from sleeping'
Posted Dec 21, 2011 14:26 UTC (Wed)
by corbet (editor, #1)
[Link] (22 responses)
Posted Dec 22, 2011 11:53 UTC (Thu)
by etienne (guest, #25256)
[Link] (21 responses)
So the developpers of highly interactive application may want to consider the case that, even if they want to respond immediately to user requests, if they did not see a user request for the last 20 days, they may enter a "power saving" state by themself - unless that is done, wavelocks seem usefull.
Posted Dec 22, 2011 17:20 UTC (Thu)
by dlang (guest, #313)
[Link] (20 responses)
Posted Dec 22, 2011 23:46 UTC (Thu)
by brendan_wright (guest, #7376)
[Link] (4 responses)
Posted Dec 23, 2011 0:08 UTC (Fri)
by neilbrown (subscriber, #359)
[Link] (1 responses)
But the "kernel" doesn't need to be particularly involved in this. User-space apps can talk to user-space suspend manager and when an appropriate time to suspend arrives the user-space suspend manager can initiate a suspend.
wakelocks as a feature are perfectly fine. However they don't need to be a kernel feature.
(well .. to be accurate there does need to be a way for kernel modules such as drivers to hold-off suspend for a while, but we have that - they are called wakeup-sources. Userspace uses a separate mechanism that is more fitting for user-space).
(and to be completely fair - there is a school of thought which says that we shouldn't be using suspend at all and so wakelocks aren't fine no matter where they are implemented. Adherents of this school believe that when a tab isn't visible the animation on it should stop and then when nothing is using CPU the CPU should reduce power usage. It is hard to argue against this in terms of elegance of the design. Whether it is practical is somewhat easier to argue against).
Posted Dec 23, 2011 11:15 UTC (Fri)
by brendan_wright (guest, #7376)
[Link]
> But the "kernel" doesn't need to be particularly involved in this.
I'm not fussed about how it works, just as long as we're not still arguing about either the need for them, or the implementation details, in two years time! :-/
Posted Dec 23, 2011 4:03 UTC (Fri)
by dlang (guest, #313)
[Link] (1 responses)
this greatly undermines the "this is the only way to make things work" argument.
Posted Dec 23, 2011 11:27 UTC (Fri)
by brendan_wright (guest, #7376)
[Link]
I don't think anyone here is saying they are the *only* way to "make things work". But they are a working implementation of a feature I think we need ASAP.
Posted Dec 23, 2011 0:56 UTC (Fri)
by mjg59 (subscriber, #23239)
[Link] (14 responses)
Wakelocks (or a functional equivalent) are entirely necessary for the Android power management model. Is the Android power management model the best one? I don't think so, but nobody (myself included) has successfully demonstrated otherwise so I think at this point people should either do the necessary work or stop complaining.
Posted Dec 23, 2011 1:52 UTC (Fri)
by neilbrown (subscriber, #359)
[Link] (13 responses)
When user-space hits a key the keyboard driver activates a wakeup-source. This has the effect of causing the suspend request to abort (yes, this can be done race-free). The CPU says awake, the keystroke is responded to, userspace notices that the user is doing something and arranges not to go to sleep just yet (user may still throw phone out the window, but it is probably because they hit the wrong key by mistake).
And as for "do the necessary work": Please see https://lwn.net/Articles/464144/. Just as soon as I can get my new phone suspending reliably I'll be testing this is a real-life situation.
Posted Dec 23, 2011 12:36 UTC (Fri)
by mjg59 (subscriber, #23239)
[Link] (12 responses)
Posted Dec 23, 2011 19:42 UTC (Fri)
by neilbrown (subscriber, #359)
[Link] (11 responses)
They haven't been tested heavily and there is no demonstration that they are sufficient for Androids needs so it my mind, that is the next step. I would like to see android running on a mainline kernel (which is nearly possible with what it in staging in -next) and then replace little bits so that it uses mainline-preferred functionality in place of Android-specific functionality and see how it works. Then we could move on from "you should do it like this" arguments - which never work - to "I have done it like this" arguments which tend to hold a lot more water.
Timeout-based wakeup sources are only needed when interacting with an external device (such as a human or a network switch) and in that case they are always needed. e.g. if you receive a wake-on-lan magic-packet you need to assume there will be real data soon but you cannot wait forever so you need a timeout. Similarly a key stroke is usually followed by another so stay awake for it. These sorts of things always need timeouts. You should need no more or fewer timeout-based wakeup sources than you would need equivalent timeouts with Android wakelocks.
Posted Dec 23, 2011 19:57 UTC (Fri)
by mjg59 (subscriber, #23239)
[Link] (10 responses)
You can defer the timeouts to userspace instead, but then your userspace has to be amazingly aware of how everything ties together - rather than having generic userspace, you now need userspace that knows every single wakeup event that the kernel may generate, and whether or not it needs to take a timeout on them. That's more complicated than the existing Android case.
I'm not arguing that the wakeup events code is bad or evil or does nothing to get us closer to a model where Android works, just that right now it only solves the simple cases and doesn't have a clear strategy for solving the difficult ones.
Posted Dec 23, 2011 21:08 UTC (Fri)
by neilbrown (subscriber, #359)
[Link] (3 responses)
The card-detect interrupt activates a wakeup_source which is then deactivated once the insertion is visible to user-space. I'm guessing that is just after the kobject_uevent() call which reports a 'change' or 'add'.
The user-space suspend daemon has a 'prepare' and a 'confirm' stage to requesting suspend. A wakeup_source activation after 'prepare' will cause 'confirm' to fail. Between these two stages it would do something like "udevadm settle". This would ensure that any kobject_uevent had actually been handled.
The udev handler for "sd card insertion" would fsck and mount, scan for viruses and new media files and sends a dbus signal to the UI. Then exit.
The UI would notice the signal, tell the suspend-daemon that it is busy, acknowlege the signal (thus allowing udev handler to exit), and then pop up a widget saying "new music and viruses available - which should I play?" and wait for the user to respond (or timeout).
So: no timeout needed in the kernel or at all until you get to user interaction. Also the user-space side seems entirely generic.
The kernel doesn't need to know when user-space consumes the event, only when the event is visible to user-space.
The suspend-daemon *can* know if user-space has consumed the event because it can ask every user-space subsystem "Have you consumed all your events", and the prepare/commit makes this race-free. It sounds expensive to ask everyone that question but I believe it can be done quiet efficiently. e.g. at start up the subsystem says "here is an fd - you just check it yourself, don't bother me". Then "ask everyone" becomes a single "select" system call.
If you have other examples that you think are more complicated I would love to hear them - I have little practical experience in this area and would love to benefit from the experience of others.
Thanks.
Posted Dec 23, 2011 21:24 UTC (Fri)
by mjg59 (subscriber, #23239)
[Link] (1 responses)
If an event occurs between confirm() being run but before the suspend is requested, you'd miss that. So the suspend needs to then fail, but that's ok if you've got a token from before you called prepare() and that token's been invalidated by another wakeup event in the intervening time. So it does sound like this could be made race-free, but it does involve adding some extra complexity to the uevent code. That's not an obviously bad idea in any case - it'd be a useful thing to have for avoiding races in the existing suspend path.
Now, how about the network case? It ought to be possible in much the same way (you'd deactivate the source when the packet has been read), but there's a pretty huge distance between an irq from a network device (where you have to activate the source just in case the packet is magic, which you don't yet know) and userspace, and it could get lost at various points in between - so you need to map every path that it could take.
This is all obviously possible, and I think your approach could certainly be made to work. But making it work well is going to involve a lot of code. Not a criticism, just an observation!
This is one of the reasons why a scheduler-based approach is more attractive in many ways - you avoid the kernel timeouts problem without having to add a huge amount of kernel complexity. It obviously does result in a bunch of additional problems on the userspace side, many of which could probably be mitigated with timer slack - but I'm obviously speaking in a purely hypothetical sense, since I haven't found the time to actually do the work necessary to make that workable. You're actually doing the work, so you get to ignore me here :)
Posted Dec 23, 2011 22:10 UTC (Fri)
by neilbrown (subscriber, #359)
[Link]
I don't think the uevent code would be changed.
I think for the sd card case there would be two wakeup sources - one for the MMC interface and one for the block device. So on card-detect the MMC interface activates its wakeup_source. It then inspects the card, figures out that it is a storage device, calls mmc_blk_probe, then releases its wakeup_source. mmc_blk_probe would activate its wakeup_source, do whatever it does, ultimately call add_disk (which will make the uevent visible to userspace) and then release the mmc_blk wakeup_source. So any driver in a wakeup chain needs a wakeup_source and needs to activate/deactivate as appropriate.
I don't know the network code very well so I'm guessing more than usual here, but I think there is an 'skbuf' that travels from device to socket queue. I imagine a single system-wide wakeup_source and a flag in the skbuf to say if it is active (a wakeup_source has a counter and so can be shared). Device sets it when creating an skbuf if wake-up is enabled and socket code clears it when it is added to a queue (or when the skbuf is discarded).
A network device might want a separate wakeup source if there is a gap between the interrupt happening and the packet being read from the network device.
But of course the devil is in the detail, and adding anything to fast-paths in the network code is a not an option so we would need to be very careful.
One step at a time :-)
Posted Dec 24, 2011 15:42 UTC (Sat)
by ndye (guest, #9947)
[Link]
First, thanks for the well-toned humor. And in the midst of a non-childish conversation . . . made my day! So long, Merry Christmas, and thanks for all the fish!
Posted Dec 23, 2011 23:14 UTC (Fri)
by dlang (guest, #313)
[Link] (5 responses)
at least not unless every app can take them, but that's not what happens in android, only 'trusted' apps are allowed to take the wakelock.
in android they still use timeouts for most of userspace consuming events, and sidestep a huge amount of it by having the power controller have a wakelock for the entire time the screen backlight is on so that you don't have to scatter wakelocks through every app.
there are many of us who think that there are better ways of dealing with this userspace problem, but the problems of doing our own kernels makes it hard to experiment.
Posted Dec 23, 2011 23:25 UTC (Fri)
by neilbrown (subscriber, #359)
[Link] (4 responses)
Posted Dec 24, 2011 6:20 UTC (Sat)
by dlang (guest, #313)
[Link] (3 responses)
even if I am trying to compile my own android kernel, there doesn't seem to be any way of installing it on a device in a way that will let me fall back to the older kernel if I run into problems with the new one (the equivalent to the old lilo -R option)
the integration of things into the mainline will greatly help the first problem, but I still don't know a good solution for the second one.
Posted Dec 24, 2011 11:50 UTC (Sat)
by mjg59 (subscriber, #23239)
[Link]
Posted Dec 24, 2011 12:30 UTC (Sat)
by Cyberax (✭ supporter ✭, #52523)
[Link]
It's _always_ possible even if your firmware is totally corrupted and even battery controller is dead. In some cases it requires a magic jig, though (a 101kOhm resistor shorting two USB lines).
Posted Mar 19, 2012 14:14 UTC (Mon)
by jimmyflip (guest, #83547)
[Link]
Posted Dec 21, 2011 2:19 UTC (Wed)
by swetland (guest, #63414)
[Link] (10 responses)
However, Android systems do not have a writable tmpfs to avoid having to deal with cleaning up after buggy or malicious apps filling up /tmp. The low memory killer will eject apps (especially background apps) that are using needed memory, and since ashmem allocated regions don't persist beyond owner-process-lifetime, they get cleaned up at that point.
ashmem sits on top of the underlying infrastructure that supports tmpfs, aiming to re-use as much as possible here.
Posted Dec 21, 2011 3:05 UTC (Wed)
by neilbrown (subscriber, #359)
[Link] (9 responses)
However the use-case you describe sounds like tmpfs with "unlink-on-last-close" which is a semantic that NFS already imposes on its "silly-delete" files (where the file is unlinked on the client but still open, so must still have a name on the server) so there is some precedent for it.
Would an "unlink-on-last-close" mount option for tmpfs fit your need? It might be a generally useful thing to have.
Posted Dec 21, 2011 4:17 UTC (Wed)
by Cyberax (✭ supporter ✭, #52523)
[Link] (4 responses)
Besides, tmpfs footprint should be taken into account during OOM killer run.
Posted Dec 21, 2011 4:41 UTC (Wed)
by cmccabe (guest, #60281)
[Link] (3 responses)
Android creates a new user for each application, and runs the application as that user. So traditional per-user disk quotas should be usable, at least in theory.
> Besides, tmpfs footprint should be taken into account during
With cgroups and the userspace OOM killer framework, you can implement whatever policy you like.
Posted Dec 22, 2011 13:02 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link] (2 responses)
Posted Dec 22, 2011 18:35 UTC (Thu)
by cmccabe (guest, #60281)
[Link] (1 responses)
Posted May 24, 2012 8:20 UTC (Thu)
by niemshchanchani (guest, #84564)
[Link]
will simply passing the the fd and then mmaping work? ( i think not, but haven't tried it )
or will i need to extend something in ashmem driver ( user / kernel side) to do that? If someone has already done / knows something abt this can you give me a starting point?
Posted Dec 21, 2011 9:51 UTC (Wed)
by josh (subscriber, #17465)
[Link] (2 responses)
In theory, a trusted process could serve the same function in userspace, by using the new cross-memory attach (CMA) mechanism. Processes could ask the trusted process to create a new piece of anonymous memory for them to use, and multiple processes could attach to that memory. (The permission issues would prove difficult to deal with, but not impossible; the trusted process would need to manage a set of cooperating processes with various credentials.) However, I think it makes sense to handle this in a much more natural way through the kernel, by associating a file descriptor with anonymous shared memory.
Posted Dec 21, 2011 12:37 UTC (Wed)
by swetland (guest, #63414)
[Link] (1 responses)
It also (though this feature came later) has functionality which allows a process to indicate ranges of pages which are not needed and may be reclaimed by the kernel in the event of a low memory situation. The idea being that using this to mark caches, etc, gives the kernel the ability to reclaim some pages as an alternative to invoking the low memory killer to obtain more memory in a pinch.
Posted Aug 1, 2018 11:25 UTC (Wed)
by meuh (guest, #22042)
[Link]
Yup -- that was the main limitation (not being able to get an fd to pass to another process for mapping) that ashmem was working around.
One could now use memfd_create(), which is available since kernel 3.17.
Posted Jan 1, 2012 16:16 UTC (Sun)
by kleptog (subscriber, #1183)
[Link]
Posted Dec 21, 2011 9:30 UTC (Wed)
by job (guest, #670)
[Link] (2 responses)
Posted Dec 21, 2011 18:11 UTC (Wed)
by tbird20d (subscriber, #1901)
[Link]
See the mailing list for some discussion of this. In general, it is conceivable to transition to more generic interfaces. However, for each one you have to evaluate what the impact is to existing code throughout user space. For example, most programs doing logging are not directly making Linux system calls, and there is likely some flexibility there to change the interface if needed. The question, IMHO, is how much change is really needed.
Posted Dec 22, 2011 4:32 UTC (Thu)
by swetland (guest, #63414)
[Link]
We're not interested in completely gutting and rebuilding the Android userspace, no matter how many times people suggest "oh you would just rewrite x, y, and z and then it would do something almost like w".
We have existing, proven, working code that's been in the field for four plus years and gets the job done. Not breaking the existing system is important. A lot of the proposed "oh just replace x with y" where y is something not-really-the-same or something reimplemented-as-a-userspace-daemon would require quite a lot of work to validate and hunt down regressions. Work that is hard to justify given everything else we need to do to keep moving the platform forward.
That said, working towards unified interfaces and the ability to run Android on "out of the box" mainline kernels is definitely a goal we're interested in.
Posted Dec 23, 2011 20:52 UTC (Fri)
by zengtm (guest, #74989)
[Link] (1 responses)
Posted Jan 24, 2012 3:43 UTC (Tue)
by zengtm (guest, #74989)
[Link]
(2) http://lists.linuxfoundation.org/pipermail/ce-android-mai...
Posted Dec 24, 2011 12:16 UTC (Sat)
by meyert (subscriber, #32097)
[Link]
Posted Dec 24, 2011 21:22 UTC (Sat)
by augustz (guest, #37348)
[Link] (1 responses)
http://lists.linux-foundation.org/pipermail/linux-pm/2009...
If I remember it didn't go well (horribly).
Google seems to have managed the engineering on these interfaces such that they have shipped 200+ million units. They are not the only one trying to base a phone platform on linux, but do seem to have made the necessary trade-offs to actually ship product.
The time to ship pressure in the embedded space does seem to lend itself to more hacky results than mainline. I'm looking forward to seeing the convergence :) Also, as the pool of embedded folks in the mainline space grows, the feedback to new contributors from embedded may improve.
Good luck to everyone!
Posted Dec 24, 2011 21:44 UTC (Sat)
by mjg59 (subscriber, #23239)
[Link]
The main reason (from my perspective) that Android is more attractive here is that it moves a lot of the responsibility away from app programmers - they can ignore a bunch of power saving and the OS looks after them. The upside of that is that it's much harder for a poorly written application to interfere with your battery life - the downside is that it makes it much easer to have a higher idle (but not asleep) power consumption. But making compromises that favour app developers results in a larger number of applications, and that makes it a more attractive platform for everyone.
Android may actually be one of the first good examples of Worse is Better in the Linux kernel sphere. The MIT people thought UNIX's signal handling code was awful. The Linux people (mostly) think wakelocks are awful. No matter how much we may dislike it on a technical front, I think the wakelock approach is sufficiently simple that it's going to outcompete other solutions.
Bringing Android closer to the mainline
Bringing Android closer to the mainline
# echo timer > trigger; echo 1000 > delay_on; echo 1000000000 > delay_off
Bringing Android closer to the mainline
Bringing Android closer to the mainline
Bringing Android closer to the mainline
Bringing Android closer to the mainline
Bringing Android closer to the mainline
Reading returns the remaining time before the output will be deasserted.
/sys/class
/sys/class
/sys/class
Bringing Android closer to the mainline
I believe the article said exactly that...is it confusing somehow?
Bringing Android closer to the mainline
Bringing Android closer to the mainline
> an Android userspace, we are only missing one piece, ashmem,...
Yepp. You are right. As you replied, Article is correct.
I mentioned to catch current -next status about the above statement
that Greg KH said on December 16. So, How do you append the below
statement additionally If you can?
on by others, and isn't necessary for Android to boot, just needed so
it doesn't drain your battery."
Bringing Android closer to the mainline
Bringing Android closer to the mainline
We'll always listen to requests, but, honestly, I've written so much about wakelocks/suspend blockers that I can't really imagine what I could add to that discussion at this point. Nothing really has changed on that front for a while now.
Wakelocks
Wakelocks
> Android's interesting approach to application management. In the Android world, applications never choose to exit. They hang around until memory gets tight, at which point kernel starts to kill them off.
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
. . . then pop up a widget saying "new music and viruses available - which should I play?" and wait . . .
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
Wakelocks
ashmem
ashmem
ashmem
ashmem
> provide per-app quotas so that one app won't be able to eat all the space.
> OOM killer run.
ashmem
ashmem
ashmem
ashmem
ashmem
memfd_create()
ashmem
Bringing Android closer to the mainline
Is it out of the question for Android to transition some kernel interfaces to more generic ones in the future? Most programs end users care about are written either for Dalvik or using NDK and shouldn't care much about wakelocks or logging for example.
Bringing Android closer to the mainline
Bringing Android closer to the mainline
I thought PMEM is to be phased out over time by Google, in favor of the new Android 4.0.x ION memory manager, as indicated by email from Google kernel engineer. If that is the case, why not include the ION driver as well in drivers/staging/android?
Bringing Android closer to the mainline
Bringing Android closer to the mainline
(1)
http://lists.linuxfoundation.org/pipermail/ce-android-mai...
Bringing Android closer to the mainline
Bringing Android closer to the mainline
Bringing Android closer to the mainline